You seem to think you have three cases (a valid string, a null string, and and undefined value.) Ronald's post suggests that this is not true for DBI. Assuming that it it true, the answer to your question is to do the tests in the right order.
if (!defined){ print qq(''); } elsif (!length) { print 'NULL'; } else { print; }
In reply to Re: Perl DBI NULL and undef
by BillKSmith
in thread Perl DBI NULL and undef
by chefchanyu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |