in reply to Re: reading several lines in a gulp
in thread reading several lines in a gulp

If the file is not a multiple of 10 lines, does that push extra undef's into the @lines?

Replies are listed 'Best First'.
Re^3: reading several lines in a gulp
by moritz (Cardinal) on Apr 27, 2011 at 13:00 UTC
    Yes, I didn't think of that. Maybe this would be better:
    sub gulp { my ($file, $count) = @_; my @lines; for (1..$count) { push @lines, scalar <$file>; last if eof $file; } return @lines; }