since the only way to find variables by name is in the symbol table, we can't possibly get a lexical this way.
In theory, the mechanism used by PadWalker could be used to lookup lexicals by name... it just isn't being done with symbolic references.
#!/usr/bin/perl use strict; use warnings; use PadWalker; my $foo="foo"; my $bar="f"; my $p = PadWalker::peek_my(0); print ${$p->{'$'.$bar.'oo'}}, "\n"; # "foo"
In reply to Re^5: Variable name
by almut
in thread Variable name
by nsteiner
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |