mjd-perl-pm on Sun, 19 Dec 1999 09:07:01 -0500 (EST)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Elegant way?

> $Name = "FirstName";
> $Value = "Jane";
> What I would like to do is create a variable $FirstName containing the 
> value "Jane"

It is almost always better, and totally straightfoward, to use a hash:

	$record{$Name} = $Value;
	print "The $Name is $record{$Name}.\n";

If you *must* do this, it is easy:

	$$Name = $Value;  

but you should see 


for reasons why this is almost always a very bad idea.

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**