Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How come undef eq '' ??

by eyepopslikeamosquito (Chancellor)
on Jan 30, 2013 at 17:07 UTC ( #1016104=note: print w/ replies, xml ) Need Help??


in reply to How come undef eq '' ??

The earlier excellent answers have already answered your question.

The best description of the why behind Perl context that I have seen is the free Modern Perl book. I encourage you to read the short opening The Perl Philosophy chapter, which contains a clear description of contexts in Perl. Especially note the "Numeric, String, and Boolean Context" section.

See also: Definition of numerically equal and rationale for 'you' == 'me'


Comment on Re: How come undef eq '' ??
Replies are listed 'Best First'.
Re^2: How come undef eq '' ??
by tmharish (Friar) on Jan 30, 2013 at 17:13 UTC

    Guess the essence is:

    Unless you really know how Perl works ... use strict; use warnings;

    Thanks for the link

      I thought 'use warnings' was discouraged for published modules? I've always added it for development, but removed for distribution.

        perlmodlib begs to differ:

        Try to use warnings; (or use warnings qw(...); ). Remember that you can add no warnings qw(...); to individual blocks of code that need less warnings.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-29 10:44 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 (263 votes), past polls