foreach $loopvariable (@data_array)
{ print $loopvariabe ; }
####
foreach (@data_array)
{ print $data_array ; } #this looks like wrong syntax
####
>perl -wMstrict -le
"my @array = qw(one two three);
for my $loopvariable (@array) {
print $loopvariable;
}
"
one
two
three
>perl -wMstrict -le
"my @array = qw(one two three);
for (@array) {
print $array;
}
"
Global symbol "$array" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
####
>perl -wMstrict -le
"my @array = ('two', 'three', 'four');
for my $loopvariable (@array) {
++$loopvariable;
}
print qq{@array};
"
twp thref fous