in reply to Recursive traversal of a HoH... and paths

I don't know the modern modules that well, but the for do-it-yourself approach, I guess if you want arbitrary depth then a hash walker might look like:
use warnings; use strict; my $hoh = { '1' => { '1a' => {} }, '2' => { '2a' => { '2b' => {} }, '2c' => { X => 1 }, } }; # This coderef examines every node to see if it is the # one we want my $evaluator = sub { my $item = shift; return (ref $item && ref $item eq 'HASH' && exists $item->{X}); }; my $path = walk_hoh($hoh, $evaluator); print "found: ", join(", ", @$path), "\n"; exit 0; sub walk_hoh { my $hr = shift; my $evaluator = shift; my $keypath = shift || []; foreach my $key (keys %$hr) { my $val = $hr->{$key}; if ($evaluator->($val)) { # We found it here return [@$keypath, $key]; } if (ref $val && ref $val eq 'HASH') { # To iterate is human, to recurse divine my $found = walk_hoh($val, $evaluator, [@$keypath, $key]); return $found if (defined $found) } } return undef; # Found nothing here }