use deref; $href = { 1,2,3,4 }; for (sort keys HASH{ $href }) { print "$_ -> $href->{$_}\n"; } #### print "This breaks the HASH{} thing.\n"; # becomes print "This breaks the %{} thing.\n";