boolean return (was Re: cpan you have to see)

Peter Sergeant pete at
Wed Dec 12 21:38:54 GMT 2012

On Wed, Dec 12, 2012 at 9:17 PM, Uri Guttman <uri at> wrote:

> then the caller can't ever use the sub in a list context expecting an
> empty list

... so?

True or false are reasonable things to expect a subroutine to return. A
list is a reasonable thing to expect a subroutine to return. True, false,
or SURPRISE! a zero-length list! does not seem like a reasonable return

I suspect that with some work, we could generate a real-world example where
a user might want a true value, OR (a false value OR an empty list). But if
that's really, really what the caller wants, they can easily stick a grep
in front of the call to the sub and get that.


More information about the mailing list