On Sun, Apr 13, 2008 at 2:32 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
>  But I am not 100% sure what you are saying on " Why are you making sure the
> data is right and then pulling the data you want out? " ?
>  I need to move onto next data if it doesn't conform to 2nd regex and then I
> am extracting only certain field and join them by _ and pushing them into
> array.
snip

You can use a regex to pull data out of a string at the same time you
are checking it for correctness.  This is almost always faster than a
regex plus code to pull the data out.  For instance, it looks like you
want something like

next unless s{
   .+\s+
   D\s+
   udp\s+
   \d+\.\d+\.\d+\.\d+\s+
   \d+\.\d+\.\d+\.\d+\s+
   \d+\s+
   \d+\s+
   (\S+)\s+
   (\S+)\s+
   (\S+)\s+
   (\S+)\s+
   (\S+)
}{
    $3_$5_$4_$6_$2_$1
}xms;

push @bad, $_;

-- 
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