$$hash{'key1'}{"$var2"} = $value; #### $$hash->{'key1'}->{"$var2"} = $value; #### foreach $key (keys %$hash{'key1'}->%* ){ print "$key\n"; }