Nalina has asked for the wisdom of the Perl Monks concerning the following question:
Hi
Can I use a variable for value of a hash? for ex
Can I use a variable for value of a hash? for ex
This displays$dw = "dw_urg"; %$dw_TG = qw( var $dw_VAR str $dw_STR mkt $dw_MKT ); foreach $key (keys %$dw_TG) { print "$$dw_TG{$key} -> $key\n"; }
but i need $dw to be replaced by its value. Please help$dw_MKT -> mkt $dw_STR -> str $dw_VAR -> var
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Hashes
by johngg (Canon) on Apr 24, 2007 at 10:29 UTC | |
Re: Perl Hashes
by dorward (Curate) on Apr 24, 2007 at 09:57 UTC | |
Re: Perl Hashes
by betterworld (Curate) on Apr 24, 2007 at 09:55 UTC |
Back to
Seekers of Perl Wisdom