in reply to Placement of "my"
Lexical scopes of control structures are not bounded precisely by the braces that delimit their controlled blocks; control expressions are part of that scope, too. Thus in the loop the scope of $line extends from its declaration throughout the rest of the loop construct (including the continue clause), but not beyond it
while (my $line = <>) { $line = lc $line; } continue { print $line; }
So A my declares the listed variables to be local (lexically) to the enclosing block, file, or eval.
|
|---|