Wc -Sx- Jones wrote:
>
> Ron McKeever wrote:
> > Thank you for replying.....
> >
> > Actually there are 7 columns the last one got cut off in the email.
> > The column im working on is the 6th.
> >
> > Thats why i thought i needed to split it?
>
> >>RIp
> >> -----           -----   -----            -----    -----            -----
> >>  -----
> >> 1074715516      111     222.222.2.2      2566     111.111.111.1    80
> >>111.111.111.1
>
>
> OK, split is fine -
> my $test = (split(/\s/,$_))[5];
> next if $test =~ /(?:25|53|80)/;
>
>
> \s is whitespace and include tabs spaces carridge returns, et al.

The default operands for 'split' are

  split ' ', $_;

which splits on whitespace but has the advantage that it won't return
an empty first field if there is leading whitespace in the object string.
There's also no need to cluster the alternatives in the regex. So we get

  while (<DATA>) {
    my $test = (split)[5];
    next if $test =~ /25|53|80/;
  }

HTH,

Rob



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


Reply via email to