In that case, you could make either of two changes:
But there is the school of thought termed the robustness principle, that goes Be conservative in what you send, be liberal in what you accept.
I would do both: make the sanity test issue a warning (with file line number) and then return undef; and add a test for undef before dereferencing.
In reply to Re^3: Can't use an undefined value as a HASH reference
by BrowserUk
in thread Can't use an undefined value as a HASH reference
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |