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

Re: param = 0, not NULL

by Ojosh!ro (Beadle)
on Mar 29, 2007 at 15:41 UTC ( [id://607295]=note: print w/replies, xml ) Need Help??


in reply to param = 0, not NULL


undef, 0 and '' will all cause the default value to be set. The simplest way to check whether your param( 'choice' ) has any or no value is the use of defined

my ( $a, $b, $c ) = ( 0, '', undef ); print defined $a, " -0-\n"; # prints 1 -0- print defined $b, " --\n"; # prints 1 -- print defined $c, " undef"; # prints 0 undef

Hope it helps.

if( exists $aeons{strange} ){ die $death unless ( $death%2 ) }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found