Empty Hash Values

Jasper jaspermccrea at gmail.com
Tue Apr 14 17:36:05 BST 2009


2009/4/14 Nigel Peck <nigel.peck at miswebdesign.com>:
>
> Thanks for all your responses on this. As a number of you pointed out, this
> is not when a value is undefined, but because a function is called in list
> context and returns an empty list.
>
> Matt, thanks for the tip, scalar() is just what I need, and much better than
> concatenating an empty string.

Adrian and I had a tiny chat about this in work, and he decided that
subs that return a scalar should return undef explicitly (if they are
just returning), and those that return a list should return.

At the time I thought it seemed very sensible, but I'm on the fence again.

Difficult to retroactively enforce, at any rate.

Jasper


More information about the london.pm mailing list