Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Using a variable to define a variable

by aaron_baugher (Curate)
on May 08, 2015 at 16:02 UTC ( [id://1126116]=note: print w/replies, xml ) Need Help??


in reply to Using a variable to define a variable

Possible? Yes:

$foobar = 'yes'; $key = 'bar'; print ${'foo'.$key};

But don't do that. There is always a better way to do whatever you're trying to do. If you use strict as you always should, it won't let you.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found