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

Re: undef and empty variables

by tilly (Archbishop)
on Jan 19, 2011 at 16:57 UTC ( [id://883160]=note: print w/replies, xml ) Need Help??


in reply to undef and empty variables

If you are not using warnings, then indeed undef will be translated into "".

However you should use warnings because it will catch other things, and so should include the defined check to avoid that warning. Furthermore think carefully about your data. It could be that "" is a valid value. Therefore my natural inclination would be to keep "" as a valid value, and map undef to null.

Replies are listed 'Best First'.
Re^2: undef and empty variables
by herveus (Prior) on Jan 19, 2011 at 17:15 UTC
    Howdy!

    Depending on the RDBMS, the empty string may not be distinguished from NULL. Oracle leaps instantly to mind as one which explicitly documents their equivalence between an empty string and NULL. That's not standards compliant, but it's Oracle.

    yours,
    Michael
      That is one of the reasons that I said "think carefully about your data" instead of "null and empty string ar different".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-18 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found