Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Answer: How to deal with undefined returned variables.

by knight (Friar)
on Jan 19, 2001 at 21:55 UTC ( #53046=categorized answer: print w/replies, xml ) Need Help??

Q&A > subroutines > How to deal with undefined returned variables. - Answer 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};

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[jedikaiti]: Hi Monks
[GrandFather]: HI jedikaiti. Collected more 73p data this morning. Rubbish sky though. Seeing was between 5 and 9 arc seconds FWHM with thin cloud drifting through :(
[GrandFather]: Still, at least some of the images are good enough to get reasonable astrometry. Well, good enough for a good plate solve anyway
[Cow1337killr]: Hello, jedikaiti

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-02-20 20:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (302 votes). Check out past polls.