--- Chirag Patel <[EMAIL PROTECTED]> wrote:
> I was wondering how to make a variable name the value of another
> variable.
> for example: $name = "jerry";
> how can I establish a variable with the name
> $jerry ?

Several ways. c.f. the other responses, but you could also use an eval:
  
  eval "\$$name = 'foo'"; # sets $jerry to 'foo'

This isn't pretty, but works.
However, I *strongly* suggest you 'use strict;', which will probably
give you six kinds of hell for trying to use symbolic references.

Symrefs are easy to do, but often a bad idea.
If you can read and understand the vars pragma module and use that
syntax intelligently, then you're well on your way to understanding
*why* it could be a bad idea, as well as having alternatives....

Why did you need this?
Is there a simpler way?



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to