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


in reply to Re^2: push in for loop
in thread push in for loop

I am glad you used map, which would be my recommendation for filtering an array. The reason the array is not being completely scanned before the for loop begins is due to memory optimization. You can always explicitly copy the array instead if needed, but it would be a code kludge to have to tell Perl not "build up the array" every time. (That's my take, anyway.)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)