On Sun, Apr 13, 2008 at 2:05 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
>            next if ! /^$start/;
snip

You should say

next unless /^$start/o;

The o makes a promise that $start won't change, so the regex only gets
compiled once (it is recompiling the regex each time through the loop
currently) and unless is easier to see than "if !" when reading code
quickly.

snip
>            next if ! m{
>                        .+\s+D\s+
>                       udp\s+
>                       \d+\.\d+\.\d+\.\d+\s+
>                       \d+\.\d+\.\d+\.\d+\s+
>                       \d+\s+\d+\s+
>                        .+
>                      }xms;
>             push @bad, join('_', ( split( /\s+/, $_))[10,12,11,13,9,8]);
snip

Why are you making sure the data is right and then pulling the data
you want out?  Do both at the same time with captures, or better yet,
since you don't do anything more with $_, just use a substitution and
push $_ onto @bad (cuts out yet another function).

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to