On May 13, rmck said:

>  while (<FHOREAD>) {
>    my $sport = (split(/\s/,$_))[8];
>    my $sdport = (split(/\s/,$_))[10];

You have $sdport here, but you USE $dport.

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

I'd probably do:

  # set up valid values for $sport and $dport
  my %ok;
  @ok{20,21,22,25,53,80,109,110,123,137,161,443} = ();

  while (<FHOREAD>) {
    my ($sport, $dport) = (split)[8, 10];
    next if $sport =~ /\D/ or $dport =~ /\D/;

    if (exists $ok{$sport} or exists $ok{$dport}) { push @rest, $_ }
    else { print FHODATA }
  }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


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