in reply to Re^2: Running out of memory while running this for loop
in thread Running out of memory while running this for loop
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: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Running out of memory while running this for loop
by Ppeoc (Beadle) on Nov 02, 2015 at 01:53 UTC |