in reply to RE: Re: read X number of lines?
in thread read X number of lines?

You can even squeeze a little more out. This is ~5% faster on my system.
my($buf, $chunk, @lines); while(read FILE, $buf, BUFFER_SIZE) { $chunk .= $buf; @lines = split /\n/, $chunk; $chunk = chomp $buf ? '' : pop @lines; foreach (@lines) {} }
(BUFFER_SIZE is just a constant I was using)