in reply to Are defined or // garantee not to autovivify?
To summarize:
Rather just do this if undef is taken as does not exist.# generally pointless, I would not use the mere existence of the key t +o mean anything; check it's value if ( exists $hashtest{abc} and defined $hashtest{abc} ) { print qq{This is worthless IMO.\n}; }
And if I want to check the value, something like:if (defined $hashtest{abc}) { print qq{Better than 'exists'; check for the value being undef or no +t undef.\n}; }
if (defined $hashtest{abc} and $hashtest{abc}) { print qq{Also, better than 'exists' and when I want to make sure the + value is not "falsey"\n}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Are defined or // garantee not to autovivify?
by haukex (Archbishop) on May 31, 2020 at 09:09 UTC |