use strict; my %h = ("foo" => 1, "bar" => 2); my %g = (); $g{\%h} = 1; my @k = keys %g; my $hashref = $k[0]; my %tmp = %$hashref; print $tmp{"foo"}