Note that compare strings with eq and ne instead of == and != since == and != coerce their arguments to numbers.# let's say you've got the user input in $input.. if (defined($input) && $input ne "") { # input is defined and not empty } else { print "input wasn't filled in\n"; }
See equality operators and defined in the documentation.
In reply to Re^2: Check Variables for NULL
by Joost
in thread Check Variables for NULL
by Trihedralguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |