The "Perlish" way to iterate element-by-element over an array is:
If each "element" of @array is actually an array reference, you might then need to iterate in turn over the referenced array in similar fashion:c:\@Work\Perl\monks>perl -wMstrict -le "my @array = qw(zero one two three); ;; for my $element (@array) { print qq{element '$element'}; } " element 'zero' element 'one' element 'two' element 'three'
Please see perldsc for more info and examples.c:\@Work\Perl\monks>perl -wMstrict -le "my @array = ( [ 1, 2, 3, ], [ 'v' .. 'z' ], [ qw(one two) ], ); ;; for my $arrayref (@array) { for my $element (@$arrayref) { printf qq{'$element' }; } print ''; } " '1' '2' '3' 'v' 'w' 'x' 'y' 'z' 'one' 'two'
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Running out of memory while running this for loop
by AnomalousMonk
in thread Running out of memory while running this for loop
by Ppeoc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |