in reply to Hash value interpolation
qSorry if I double posted...
Thanks Ikegami, your idea/solution gets me further; however, now I do not get any output. Looks like I'm still doing something wrong. below is the test code I'm using:
would apreciate the extra help.
Thanks again!
use warnings; use strict; my $COLOR=2; my $hm=""; my $ht=""; my %h1 = ( "1" => "blue" ); my %h2 = ( "2" => "green" ); if ( $COLOR == 1 ) { $ht=\%h1; } elsif ( $COLOR == 2 ) { $ht=\%h2; } sub geth { while ((my $key, my $value) = each(%$ht)) { if ( $key == $COLOR ) { $hm=$value; } } print "$hm\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Hash value interpolation
by jasonk (Parson) on Feb 16, 2009 at 22:11 UTC | |
by csarid (Sexton) on Feb 17, 2009 at 21:00 UTC |
In Section
Seekers of Perl Wisdom