in reply to Re: Re: Correct Loop Structure
in thread Correct Loop Structure
If there are more than a very few lines that don't have ";drop;" in them, also put a next unless /;drop;/; just before the foreach.my %seen; my %newip_res; for my $ip (@newips) { $seen{$ip} = 0; $newip_res{$ip} = qr/;drop;[^"]*$ip/; } while(<LOG>){ foreach my $ip (@newip) { ++$seen{$ip}, print OUTFILE if $seen{$ip} != 500 && /$newip_res{$i +p}/; } }
|
|---|