Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
"be consistent"
 
PerlMonks  

Re: Re: using strict refs

by Hofmator (Curate)
on Aug 28, 2001 at 14:02 UTC ( [id://108443]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: using strict refs
in thread using strict refs

The eval version works, the other version doesn't work because symbolic references only work for package variables - not for lexical variables declared with my. So:

#!/usr/bin/perl -w use strict; my $i = "test"; # this is now a package variable and requrires an explicit # package name because of use strict $main::test = "success"; { no strict 'refs'; print "$$i\n"; }

-- Hofmator

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://108443]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.