PERL: how to tell if variable is NULL

How to I do a check on a variable to see if it's null-- I am using Perl.

if ($str eq '') {
  <some commands>
}

Works like a charm...thanks.

The function "defined" may also achieve what you require; check the usual perldoc for details.

:slight_smile:

Oh that's pretty cool - I don't really like $str eq '' anyway.. i like a more concrete test like isnull(xxx) or something where you can look at it and right away you know what it's testing for.

my ($some);
$some = "";
if (defined($some)) {
 print "defined";
} else {
 print "not defined";
}

If you remove [$some = "";] you'll see "not defined" instead of "defined".