Rmck wrote:
> 
> Hello,

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

my ( $sport, $dport ) = grep /^\d+\z/, ( split )[ 8, 10 ] or next;

if ( grep  =~ /^(?:2[0125]|53|80|1(?:09|10|23|37|61)|443)$/, $sport, $dport ) {
    push @rest, $_
    }
else {
    print FHODATA
    }



John
-- 
use Perl;
program
fulfillment

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