In general, Perl does like C. There is some historical weirdness that we just have to live with. In Perl a .pm module has to return non-zero when "all is ok" (usually just by last line of 1;), but a Perl program returns (0) to the O/S if it works (*nix or Windoze). Perl should return a positive error code if it abends. This is strange and inconsistent and I'm not saying that it isn't.
For the most part the Perl functions and C functions do what you expect in terms of true/false. In C there is weirdness with EOF, that's -1. So, yes there are funcs that return negative values for "true". In Perl most of these weirdo cases have been solved and I'm not saying that they aren't. I've never tested a loop for an EOF value in Perl... the subject just doesn't come up.
I am saying that returning a negative number for an error code is a strange thing to do. If non-zero means a error code, then a positive number is far better than a negative number. For a T/F value, return either 0 or a positive number.
In reply to Re^5: How do I use a block as an ‘or’ clause instead of a simple die?
by Marshall
in thread How do I use a block as an ‘or’ clause instead of a simple die?
by boom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |