Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^5: Perl Style: ... (TRUE, FALSE and FAILED)by LanX (Saint) |
on Aug 23, 2010 at 10:08 UTC ( [id://856671]=note: print w/replies, xml ) | Need Help?? |
> So what exactly do you mean by not returning undef to "explicitly" return false. maybe a little example will make it clearer
line 4 is of course redundant, return; and return (); do exactly the same thing. > I have found it wise to always return an explicit value, OK, if you wanna code more "explicitly", you should better define constants for TRUE, FALSE and FAILED.
If you wonder about my definition of FALSE, see Truth and Falsehood in perlsyn:
UPDATE: please note: FALSE is defined!
i.e. FALSE acts like a defined value like in most other languages. UPDATE: On second thought FAILED should better be named EMPTY or NOTHING. Failure is just an interpretation of returning nothing.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|