If I wanted to read X lines at a time (say 100), how should I do that using $/ ?
Some regex with a look behind to find 100 \n's would do the trick, probably... but isn't there an easier way? :-|
From perlvar:
Remember: the value of $/ is a string, not a regex. awk has to be better for something.
That routine can be as simple as a for() loop. Once you code those five or six lines, relax, put your feet up on the table, and get on with life.my @lines = read_lines( $fh, 100 );
Re:Don't do too much work
cog on 2004-05-05T11:48:36
What do you mean, five or six lines?:-)
while (@_ = map eof() ? () : scalar , 1..$n) { #
... } Courtesy of the guys from the FWP list
:-)