if ( ! defined $x )
I read up on defined and undefined. But I'm looking for a test that will
this return true or false to a var condition:
perldoc -f defined
perldoc -f undef
The second is a little different than what you think though.
sub isNULL {
if ( ! defined($_[0]) || $_[0] eq '') { return 1; } else { return; }
} # my goal is all three return the same as # my proposed sub isNULL() my $x; # undefined $x=""; # zero length $x=''; # zero length
That last two are identical.
If you don't mind considering 0s NULL too, you can do even better:
do_something() if $x; # won't happen on undef, '' or 0 values for $x
Would the new sub do or is there a better?
A sub is better for a complex check most likely. Especially if you intend to do it repeatedly.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]