in reply to Re: efficiency & style
in thread efficiency & style
and then you change the loop to:my %service = qw( 0050 www 0016 ssh 1A0B irc 0015 ftp ); my $match_lst = join "|", keys %service; my $match = qr/:($match_lst)\s/;
If you want you can speed it up even more by optimizing the RE as I did in RE (tilly) 4: SAS log scanner.foreach my $line (grep /\b01\s/, `cat /proc/net/tcp` ) { ++$count{$service{$1}} while $line =~ /$match/g; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE (tilly) 2: efficiency & style
by dchetlin (Friar) on Sep 23, 2000 at 14:13 UTC | |
by tye (Sage) on Sep 23, 2000 at 18:52 UTC | |
by tilly (Archbishop) on Sep 23, 2000 at 20:26 UTC |