http://www.perlmonks.org?node_id=611655


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; while (<$fh>) { next if /^;/; # ... process lines }