As an optimization (I suspect) of an implementation detail, perl translates lexical variables into array accesses, where each lexical pad is an array. That's not quite exactly correct, but it's close enough to explain why you can look up and rebind global symbols -- those that live in the symbol table -- but not lexicals. perl always looks up global symbols (package variables, subroutine names) by name and lexical symbols by lexical pad index.
If you examine the optree with B::Concise or a similar module, you'll notice the difference in gvsv and padsv ops.
In reply to Re: Scope Puzzle
by chromatic
in thread Scope Puzzle
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |