in reply to Cleaning up a text file with compact regex
open( my $fh, '<', 'file.txt' ) or die "Cannot read file.txt: $!\n";
# clearer idiom, anyone?
scalar <$fh> for 1 .. 6;
next if /^;/;
# ... process lines
You should always put local($_); before such a loop, because the global variable $_ is set to each line and is not cleaned up in the end.
Update: http://perl.plover.com/local.html has an example of the dangers of this kind of while loop.
Results (130 votes). Check out past polls.