Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Answer: How to deal with undefined returned variables.

( #53046=categorized answer: print w/ replies, xml ) Need Help??

Q&A > subroutines > How to deal with undefined returned variables. contributed by knight

davorg presents the common idiom, but note that it can lose if the actual value returned is "defined but false", e.g. 0 or "0". To handle this robustly can be done in two lines:
$CONFIG{HASHTYPE} = $cfg->val("MISC","HASHTYPE"); $CONFIG{HASHTYPE} = "shal" if ! defined $CONFIG{HASHTYPE};

Comment on Answer: How to deal with undefined returned variables.
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-12-21 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls