Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
XP is just a number
 
PerlMonks  

Re: Dereferencing simple variable

by akho (Hermit)
on Apr 01, 2009 at 13:45 UTC ( #754702=note: print w/ replies, xml ) Need Help??


in reply to Dereferencing simple variable

It looks like you are trying to use variable names stored in strings? This is not a very good thing to do, and you should probably reconsider.

However if you insist on doing that, you should look into symbolic references (see perlref). They only work with package variables, however (not those created with my). This seems to work:

my $test = "help"; our $help = 1; no strict 'refs'; if(defined($$test)){ print "defined\n"; };


Comment on Re: Dereferencing simple variable
Select or Download Code
Re^2: Dereferencing simple variable
by chrishowe (Acolyte) on Apr 01, 2009 at 14:03 UTC
    I'm going to try and reconsider. As above, hashes are most proably the way forward!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://754702]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-04-17 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (437 votes), past polls