Which is the best implementation(in terms of speed and memory usage) for iterating through a Perl array? Is there any better way? (@Array need not be retained).
@Array
In single line to print the element or array.
print $_ for (@array);
NOTE: remember that $_ is internally referring to the element of @array in loop. Any changes made in $_ will reflect in @array; ex.
my @array = qw( 1 2 3 ); for (@array) { $_ = $_ *2 ; } print "@array";
output: 2 4 6