Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: if not defined

by pKai (Priest)
on Mar 23, 2007 at 20:51 UTC ( #606345=note: print w/replies, xml ) Need Help??


in reply to Re^3: if not defined
in thread if not defined

The OP wants

if (!defined($pname) && $pname ne '')

really?

For one, we have

>perl -w -e "print 1 if !defined($pname) && $pname ne ''" Use of uninitialized value in string ne at -e line 1.
While

not defined($pname) && $pname ne ''

if, and only if

! defined($pname) || $pname eq ''

Which looks perfectly reasonable in a test like

if (!defined($pname) || $pname eq '') { croak 'We want something real in $pname. Not undef or the empty st +ring'; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-04-17 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?