Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: if not defined

by pKai (Priest)
on Mar 23, 2007 at 20:51 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://606345]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-23 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found