alienhuman has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I've got a hash that looks something like this:
%hash = { 'key1' = '$foo', 'key2' = '$bar', 'key3' = '$baz' }
Is there a way to get the value of key1, key2 or key3 in such a way that perl interpolates $foo, $bar or $baz respectively?
If I do:
my $not_interpolated = $hash{key1}
$not_interpolated is equal to the string "$foo" and not the value of $foo.
AH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: interpolate variable in a hash?
by broquaint (Abbot) on Sep 15, 2003 at 16:09 UTC | |
|
Re: interpolate variable in a hash?
by hardburn (Abbot) on Sep 15, 2003 at 16:08 UTC | |
|
Re: interpolate variable in a hash?
by ctilmes (Vicar) on Sep 15, 2003 at 16:01 UTC |