open my $fh, '<', 'myfile.log'; until (eof $fh) { my @hundred_lines = grep defined, map scalar <$fh>, 1..100; chomp @hundred_lines; ...; # do something with the lines }