in reply to Re: Re: Correct Loop Structure
in thread Correct Loop Structure

If the performance isn't good enough, you can probably increase it a fair amount by doing something like this (untested):
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}/; } }
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.