The one on the left hand side of the assignment is a lexical variable and it will be in scope from this statement until the end of the innermost enclosing block.
Minor nit: s/from this statement/from the next statement/; Variables declared with my begin to be visible at the next statement, as documented in perlsub and demonstrated here:
my $c=4; if (my $c and !defined $c) { print "in\n"; }
This prints nothing, since defined is accessing the outer $c (that is defined) even when it's after the my declaration in the same statement.
--
David Serrano
In reply to Re^2: what is the scope of my $x=$x
by Hue-Bond
in thread what is the scope of my $x=$x
by perladdict
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |