Hello,

This code below works. But I am wondering if it can be made more efficient:

   while (<FHOREAD>) {

my $sport = (split(/\s/,$_))[8];
my $sdport = (split(/\s/,$_))[10];
next if $sport =~ /\D/;
next if $dport =~ /\D/;
   if ($sport =~ /^(20|21|22|25|53|80|109|110|123|137|161|443)$/ || $dport =~ 
/^(20|21|22|25|53|80|109|110|123|137|161|443)$/) { push @rest, $_ }
    else { print FHODATA}
  }
  print RFHODATA @rest;
}

8 and 10 are numbers 80,5000,53, etc..
will print if 8 0r 10 match my list to one file and it if dosen't match print to 
another file. 



I looked at doing something like this but no good:

  while (<FHOREAD>) {
my $sdport = (split(/\s/,$_))[8],[10];
next if $sdport =~ /\D/;
    if ($sdport =~ /^(20|21|22|25|53|80|109|110|123|137|161|443)$/) { push @rest, $_ }
     else { print FHODATA}
  }
  print RFHODATA @rest;

Thanks
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