my @lines; push @lines, scalar <$file> for 1..10;
No need for a primitive for something that can be easily achieved with existing primitives, and isn't used all that often.
Perl buffers the data it reads from the file, so it shouldn't be much less efficient than slurping a small file in list context.
In reply to Re: reading several lines in a gulp
by moritz
in thread reading several lines in a gulp
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |