in reply to Correct Loop Structure

Once $seen hits 500, it never gets incremented again.

Put $seen = 0; inside the while loop but outside of the foreach.

Update: Although I'd probably do something clsoer to

while(<LOG>){ foreach my $i (@newips){ if (/\;drop;[^"]*$i/) { print OUTFILE for 1 .. 500; } } }

(Untested)