> perl -E 'my $a=25; my $x=\*a; ... '
This code doesn't do what you think it does.
*a is always addressing the typeglob of the global symbol(s) named a , i.e. &a, $a, @a, %a the filehandle a and the format a .
( see here for how to use the clearer {SLOT} syntax.)
Maybe this code example makes it clearer:
DB<104> $a=42; my $a=666; my $ra=\*a; print $$$ra
42
update
Best think of the STASH (= Symbol Table Hash) as a Hash of Hashes, where the second level "hash" is a special structure called "glob" which always has exactly 6 fixed entries, which are either undef or a reference.
Lexicals use a totally different mechanism in the so called "Pad" and can't be addressed with * because there is nothing like a "lexical glob" unifying all lexical symbols.
If you use PadWalker to introspect pads you'll see that $x', '%x', '@x listed as separate top level symbols.
|