in reply to Re^3: reading several lines in a gulp
in thread reading several lines in a gulp
Good use of //. Confirmed that it works:
use strict; use warnings; my $fh = \*DATA; while (! eof $fh) { my @lines = map { <$fh> // () } 1..10; print "lines = " . @lines . "\n"; } __DATA__ line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 line 11 line 12 line 13 line 14 line 15 line 16 line 17
Outputs:
lines = 10 lines = 7
|
|---|