in reply to Perl DBI NULL and undef
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; }
|
|---|