This makes sense. It is technically redundant: 'undef' evaluates to the empty string in string context, so undef ne "" is false. However, evaluating undef in a string context gives you a warning if use warnings is turned on, so what you wrote is the proper thing to do.if (defined $p && $p ne "") { # To see if $p had non-null value # Do something }
In reply to Re^2: defined vs null string
by matyasbot
in thread defined vs null string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |