sub some_key { my $hash_ref = shift; %$hash_ref or return; my ($key, undef) = each %$hash_ref; keys %$hash_ref; # reset iterator $key; }