in reply to Working Through An Array In Chunks

Rather than accumulating all your data in an array and then outputting it in arbitrary sized chunks regardless of the user terminal size. Which also means the user has to wait until you've produced it all, before seeing any of it. You could use something like

perl -wle" open OUT, '| more'; print OUT $_ for 1 .. 1000"

Ie. Open a handle to the system/user more program and then just print the data as you produce it and let the system utility take care of the paging. This has the added value of giving the user access to all the system utility's facilities, like backing up, search etc.


Examine what is said, not who speaks.
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon