Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^6: Perl Style: ... (TRUE, FALSE and FAILED)

by ait (Friar)
on Aug 25, 2010 at 00:32 UTC ( #857048=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Perl Style: ... (TRUE, FALSE and FAILED)
in thread Perl Style: Is initializing variables considered taboo?

If you wonder about my definition of FALSE, see Truth and Falsehood in perlsyn:

From the pod you are reffering to:

The number 0, the strings '0' and '' , the empty list () , and undef are all false in a boolean context. All other values are true. Negation of a true value by ! or not returns a special false value. When evaluated as a string it is treated as '' , but as a number, it is treated as 0.

I still believe it's more customary to use undef as the ultimate null and false value in Perl. For example in DBI, DBIx::Class and alike, if you set a field to undef it will store in the database as an actual NULL whereas if you use '' (the empty string) you will get a blank string in the database, probably not what you'd want. I have a feeling that the explicit returning of undef is a quite popular convention :)

This "ultimate null/false discussion" is probably steering OT and should move to a new thread IMO, though I would suspect that it has been discussed ad nauseam here in PM.


Comment on Re^6: Perl Style: ... (TRUE, FALSE and FAILED)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2015-07-02 18:47 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 (44 votes), past polls