Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl DBI NULL and undef

by BillKSmith (Deacon)
on Aug 22, 2012 at 13:29 UTC ( #989036=note: print w/ replies, xml ) Need Help??


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; }
Bill


Comment on Re: Perl DBI NULL and undef
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989036]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-07-08 00:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls