Perl Monk, Perl Meditation | |
PerlMonks |
Re^4: printing unitialized value of the 'do BLOCK'by rsFalse (Chaplain) |
on Dec 23, 2019 at 08:22 UTC ( [id://11110538]=note: print w/replies, xml ) | Need Help?? |
Hey! So it means that an 'if' statement in function/RHS context returns the last expression evaluated! And this isn't documented I guess. I guess newcomer would expect to get a 1 or ''/0 as a return value of 'if', but he can get also an 'undefined'. E.g. print do { 3 if undef }; .= Interestingly, only one of these lines gives a warning:
In Section
Seekers of Perl Wisdom
|
|