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' warning:
if (defined $name && length $name > 0) { # do something with $name}
Is there a better (presumably more concise) way to write this?