Jeremy Howard wrote:
>
> Can we have an isnull() function then, please. Otherwise there's no
> operation to test for nullness.
>
> PS: Nullness? Nullility?
I've been thinking about how to test for nullirificity. The problem is
that introducing an 'isnull' keyword without a 'null' keyword seems
pretty strange:
use tristate;
$a = undef;
carp "\$a is null!" if isnull $a;
That's pretty weird. I think a more Perlish way is to simply use
'defined':
use tristate;
$a = undef;
carp "\$a is null!" unless defined($a);
That way, "defined($a)" will always return false for the above,
regardless of the "use tristate" pragma. It seems more consistent in
keeping with the "undef really means uninitialized" idea too.
-Nate