in reply to Should calling 'exists' create a hash key?
1. Use last to abort the statement (adapted from Re: Shortcut operator for $a->{'b'}=$b if $b;):print "defined\n" if (exists($x->{fred}->{dave}));
{ print "defined\n" if (exists(%{$x->{fred}||last}->{dave})); }
2. Redirect to an anonymous empty hash ref:
print "defined\n" if (exists(%{$x->{fred}||{}}->{dave});
|
|---|