in reply to Re: what is the scope of my $x=$x
in thread what is the scope of my $x=$x

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