in reply to reading several lines in a gulp

If it's unix, for max perf. I'd seek to successive (4096 byte) buffered IO page boundaries per outer iteration, transfer the lines contained to an array, process those in an inner iteration and carry over the last incomplete line (if no \n) to the next IO page iteration.

One world, one people

Replies are listed 'Best First'.
Re^2: reading several lines in a gulp
by moritz (Cardinal) on Apr 28, 2011 at 17:08 UTC
      Yes, but if you read a whole file into an array, in spite of such optimisation being reasonable at that point, Perl won't reorganise your code to minimise memory usage, nor does it provide hooks to insert your code per iteration of such optimisation.

      One world, one people