T
Todd
Why can't we explicit using local loop variable in the code snippet
below?
#! /bin/perl
for local $a (1..2) {
print $a;
}
__END__
syntax error at - line 3, near "for local"
Execution of - aborted due to compilation errors.
You see here `my'/`our' are allowed in the code snippet below, why not
`local'?
#! /bin/perl
for my $a (1..2) {
print $a;
}
__END__
12
#! /bin/perl
for our $a (1..2) {
print $a;
}
__END__
12
-Todd
below?
#! /bin/perl
for local $a (1..2) {
print $a;
}
__END__
syntax error at - line 3, near "for local"
Execution of - aborted due to compilation errors.
You see here `my'/`our' are allowed in the code snippet below, why not
`local'?
#! /bin/perl
for my $a (1..2) {
print $a;
}
__END__
12
#! /bin/perl
for our $a (1..2) {
print $a;
}
__END__
12
-Todd