in reply to Re^5: Hard syntax error or disambiguable parsing?
in thread Hard syntax error or disambiguable parsing?
... a symbolic place holder that is only valid within the scope of the loop body.
Right, but it is subject to the same scoping rules as any other perl variable, i.e. to the variable it aliased:
use strict; our $i; sub bar { print "<$i>" } for $i (1..3) { bar } # localized for my $i (1..3) { bar } print "'$i'" __END__ <1><2><3><><><>''
use strict; my $i; sub bar { print "<$i>" } for $i (1..3) { bar } # already 'my' for my $i (1..3) { bar } print "'$i'" __END__ <><><><><><>''
|
|---|