Perl: the Markov chain saw | |
PerlMonks |
Strange behaviour of interpreter when dereferencing an undefined valueby kejv2 (Acolyte) |
on Nov 02, 2014 at 09:33 UTC ( [id://1105820]=perlquestion: print w/replies, xml ) | Need Help?? |
kejv2 has asked for the wisdom of the Perl Monks concerning the following question: Hi all, I have come across this strange (at least to me) behaviour of perl interpreter. Let me give you an example: This unsurprisingly gives a run time error "Can't use an undefined value as a HASH reference". But then I would think that so does any of these:
Instead it seems that perl in this case (function context?) just translates those hash or array dereferences to empty structure and gives no error. Can somebody explain what is going on here? (Tested with perl 10, 14 and 20.)
Back to
Seekers of Perl Wisdom
|
|