CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Fun With Perl: Perl Quizzes - Learn Perl the Fun Way:
perl dyname variable name help

 



chefchanyu
New User

Aug 8, 2011, 11:30 PM

Post #1 of 2 (19301 views)
perl dyname variable name help Can't Post

Hi every one:

I been looking for solution dynamically create a variable name.
something like this:

my new21MO = "testing";
my $number = 21;
my $exName = "MO";

my $string = "new" . $number . $MO;
print $$string; <------------- I tested this aren't working.

is there a way to declare this string to a variable?
please help me out.


FishMonger
Veteran / Moderator

Aug 10, 2011, 9:39 AM

Post #2 of 2 (19265 views)
Re: [chefchanyu] perl dyname variable name help [In reply to] Can't Post

What you're asking about is called symbolic references and using them is a very bad idea.

Use a hash instead of symbolic references.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives