use Data::Diver qw/ Dive /; print Dive( \%hash, qw/ key0 key1 key2 /); ## doesn't alter %hash