my %hash; $hash{alpha}{state} = eval('$A::alpha_state'); print '$hash{alpha}{state}=', $hash{alpha}{state}, "\n"; #### our $alpha_state = 'STATE'; our $beta_state = 'state'; our $alpha_country = 'COUNTRY'; our $beta_country = 'country'; my %hash; # convert yucky legacy variables into nice hashes for my $k1 qw(alpha beta) { for my $k2 qw(country state) { $hash{$k1}{$k2} = eval '$'.$k1.'_'.$k2; } } # print out the hash for my $k1 (keys %hash) { for my $k2 (keys %{$hash{$k1}}) { print "$k1,$k2=",$hash{$k1}{$k2},"\n"; } } #outputs alpha,country=COUNTRY alpha,state=STATE beta,country=country beta,state=state