sub DiveRef { my $p = \shift; $p = \( $$p->{$_} ) for @_; $p } my %myhash; my $ref = DiveRef(\%myhash, qw( bedrock flintstone fred )); -or-- my $myhash; my $ref = DiveRef($myhash, qw( bedrock flintstone fred )); $$ref = 42; # set it to 42 $$ref++; # increment it print $$ref; # print it!