my $v; # ... $v = $hash{$foo}->{$bar}; # ... some lines later the same location # has to be retrieved to check for changes # to the multilevel hash $ref = [ $foo, $bar ]; my $nv = $hash{$ref}; if ($v eq $nv) { ...