Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: What could make "()" a good value for boolean false?by ikegami (Patriarch) |
on Mar 31, 2016 at 02:58 UTC ( [id://1159174]=note: print w/replies, xml ) | Need Help?? |
I hope not, because I'm opposed to it. Sub that are expected to return a scalar shouldn't suddenly return nothing. It causes subtle problems that aren't caught by the compiler. Consider what happens if type suddenly returned nothing instead of `undef`:
return (); should be used for subs that are expected to return a list. return undef; should be used for subs that are expected to return a scalar. There are exceptions, of course.
In Section
Seekers of Perl Wisdom
|
|