[ Create a new account ]
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. :-)
my @lines = read_lines( $fh, 100 );
while (@_ = map eof() ? () : scalar , 1..$n) { # ... }
Courtesy of the guys from the FWP list :-)
Get More Comments
Reply
Uh, no. (Score:1)
From perlvar: :-)
Remember: the value of $/ is a string, not a regex. awk has to be better for something.
Inline (Score:1)
Don't do too much work (Score:2)
Re:Don't do too much work (Score:1)
while (@_ = map eof() ? () : scalar , 1..$n) { # ...
}Courtesy of the guys from the FWP list :-)