Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: variable with $$

by The Mad Hatter (Priest)
on Apr 08, 2004 at 04:52 UTC ( #343498=note: print w/ replies, xml ) Need Help??


in reply to variable with $$

Put $name in double quotes and then backslash (escape) the extra $...
my $name = "Sam"; my $newvar = "\$$name"; # or even ... my $newvar = '$' . $name; print $name, "\n", $newvar;
which prints
Sam $Sam
Comment on Re: variable with $$
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2016-04-29 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW







    Results (438 votes). Check out past polls.