Pathologically Eclectic Rubbish Lister | |
PerlMonks |
How can I access a dynamic variable while a similarly named lexical is in scope?by faq_monk (Initiate) |
on Oct 08, 1999 at 00:27 UTC ( [id://695]=perlfaq nodetype: print w/replies, xml ) | Need Help?? |
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version:
You can do this via symbolic references, provided you haven't set
local $var = "global"; my $var = "lexical";
print "lexical is $var\n";
no strict 'refs'; print "global is ${'var'}\n";
If you know your package, you can just mention it explicitly, as in
$Some_Pack::var. Note that the notation $::var is not the dynamic
|
|