I currently use the following Perl to check if a variable is defined and contains text. I have to check defined first to avoid an \'uninitialized value\' warnin
defined
In cases where I don't care whether the variable is undef or equal to '', I usually summarize it as:
undef
''
$name = "" unless defined $name; if($name ne '') { # do something with $name }