http://www.perlmonks.org?node_id=1018875


in reply to Re: Checking if hash value exists without implicitly defining it
in thread Checking if hash value exists without implicitly defining it

You don't even need the exists (assuming you don't have a weird freeform data structure):

if (Hash{$neededVal} and $Hash{$neededVal}{param1} and $Hash{$neededVal}{param1}{key1} > 4) {

Replies are listed 'Best First'.
Re^3: Checking if hash value exists without implicitly defining it
by Kenosis (Priest) on Feb 15, 2013 at 15:47 UTC

    Yes, you're correct! Originally omitted exists when not testing for the final value--then overgeneralized. However, testing $Hash{$neededVal}{param1}{key1} would fail when $Hash{$neededVal}{param1}{key1} == 0, but expliciting testing the value, as you've shown, would remedy that.