http://www.perlmonks.org?node_id=1050459


in reply to Processing large files

When you've fixed the bugs mentioned above, you'll also need to squash this bug:

Once the while loop exits, you need to process the remaining 1 to 2999 lines in @array.

Whenever you process anything in "chunks" > 1 thing, always remember to process the final partial chunk (if it exists).