
japhy
Enthusiast
Aug 28, 2000, 3:01 PM
Post #2 of 3
(102 views)
|
|
Re: Got a variable name as string, want to set the variable
[In reply to]
|
Can't Post
|
|
You're very close: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> eval "$abc = 'newvalue'"; </pre><HR></BLOCKQUOTE> Perl first interpolates $abc's value in the double quoted string, and then executes the code that results: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $def = 'newvalue' </pre><HR></BLOCKQUOTE> ------------------ Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher
|