Article View: pl.comp.lang.perl
Article #52094Re: problem logiczny ze skryptem
From: Szymon Sokół
Date: Mon, 06 Dec 2010 21:33
Date: Mon, 06 Dec 2010 21:33
26 lines
2007 bytes
2007 bytes
On Mon, 6 Dec 2010 22:25:54 +0100, Szymon Sokół wrote:
Po chwili namysłu - ten kawałek:
> if($_ =~ /(?:from|to)=<($regexp)>/o) {
> # znaleziono jeden z szukanych adresów
> my $adres = $1;
> # ustalamy queue-id
> if(m/:\s([0-9A-F]{10}):\s/) {
> # mapujemy queue-id na adres
> $qid{$1} = $adres;
> }
> }
przecież można zoptymalizować:
if(m/:\s([0-9A-F]{10}):\s.*(?:from|to)=<($regexp)>/o) {
# znaleziono jeden z szukanych adresów
$qid{$1} = $2;
}
--
Szymon Sokół (SS316-RIPE) -- Network Manager B
Computer Center, AGH - University of Science and Technology, Cracow, Poland O
http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS: 0xF9289982 F
Free speech includes the right not to listen, if not interested -- Heinlein H
Technical Details
Message-ID:
<3vkobog9cyad$.dlg@falcon.sloth.hell.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mailReferences:
<idbb3m$dpe$1@inews.gazeta.pl> <idghvm$7d6$1@inews.gazeta.pl> <idjfvc$ksa$1@news.onet.pl> <1e9ldsaa3rl1d$.dlg@falcon.sloth.hell.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!dustpuppy.sloth.hell.pl!not-for-mail
From: Szymon Sokół
<szymon@bastard.operator.from.hell.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: problem logiczny ze skryptem
Date: Mon, 6 Dec 2010 22:33:14 +0100
Organization: Guy Fawkes Society
Lines: 26
Sender: szymon@news.agh.edu.pl
Message-ID: <3vkobog9cyad$.dlg@falcon.sloth.hell.pl>
References: <idbb3m$dpe$1@inews.gazeta.pl> <idghvm$7d6$1@inews.gazeta.pl> <idjfvc$ksa$1@news.onet.pl> <1e9ldsaa3rl1d$.dlg@falcon.sloth.hell.pl>
NNTP-Posting-Host: 89-78-159-131.dynamic.chello.pl
Mime-Version: 1.0
X-Trace: news.agh.edu.pl 1291671477 11133 89.78.159.131 (6 Dec 2010 21:37:57 GMT)
X-Complaints-To: abuse@agh.edu.pl
NNTP-Posting-Date: Mon, 6 Dec 2010 21:37:57 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.15.1 Hamster/2.1.0.11
X-Face: xic?6f"rD)k-tM.]L]A6l4W7_aGt({}&{D,hiRI.8cPtf,1F.w@Qkl!vr23o1UY-BfXO$p< hk5>ijB?eBy)?!C<@)+%U\&`1X)MJ>.i.qgkY]4mvL62j<|xJRG/5:7:l8q]x;v!)Bz^r/!yG8DxoD -@fnC,g]BAXj
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit