# Name it absolutely $foo{some}{path}{to}{the}{thing}{I}{want} = "something"; # Or relatively: my $h_ref = $foo{some}{path}; foreach my $thing (keys %$h_ref) { print "Found key '$thing' with value $h_ref->{$thing}\n"; }