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

kommesel has asked for the wisdom of the Perl Monks concerning the following question:

I have a huge array (in the area of gigabytes) and I wish to loop over (with foreach and the like) However, once I loop over an element I have no need for it. It's quiet tempting to use shift at each iteration to shrink the array and save memory. However, the overhead of resizing the array may cause an overall degradation of performance in comparison to just looping over the huge array. Can anyone give me any definite answer as to which will yield more performance (or how can I emprically check it)? P.S. The workstation will use swap files for sure