rdw has asked for the wisdom of the Perl Monks concerning the following question:
Ok, this couldn't get much simpler - all I want to do is read multiple lines (or records) from a file.
I could do this :-
my @slurp = <IN>; while (my @chunk = splice(@slurp, 0, 10)) { # do stuff }
Or I could go completely mad and do this :-
while (my @chunk = map{scalar<IN>||()} 1..10) { # do stuff }
I don't want to read the whole file into memory, so the first solution is no good for me, but the second solution seems a little silly.
Anybody got any better ideas?
Have fun,
Back to
Seekers of Perl Wisdom