http://qs321.pair.com?node_id=646959


in reply to Re: undef == 0?
in thread undef == 0?

Tristate... you said the magic word!

my $test = return_from_function(); if (not defined $test) { # do this if evaluates to undefined } elsif (!$test) { # do this if evaluates to zero equivalent } elsif ($test) { # do this if evaluates to non-zero equivalent }

If you really wanted, you could throw in a $test eq '' in there too, but I've found that to be gratuitous code abuse.