http://qs321.pair.com?node_id=744213


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"; }