in reply to Ask a Silly Question...
Unlike package variables, Perl can have multiple lexical (my) variables with the same name in existence at the same time (Upd: so such a lookup mechanism wouldn't work ).
Nested scopes.
my $x; { my $x; ... }
Closures.
{ my $x; sub f { ++$x } } { my $x; sub g { ++$x } }
Recursion.
sub f { my $x; ... f(); ... }
Each exist as a different pad entry on the pad of the function that encapsulates it.
|
|---|