Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Perl Monk, Perl Meditation
 
PerlMonks  

Answer: How to deal with undefined returned variables.

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

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

Russ mentioned that the // operator is in Perl 6, but in fact it is available in Perl 5.10:
use 5.010; $CONFIG{HASHTYPE} = $cfg->val("MISC","HASHTYPE") // 'sha1';
This only puts 'sha1' in your config value if your $cfg->val returns undef or nothing.

Definitely a valuable addition to the language.

Comment on Answer: How to deal with undefined returned variables.
Select or 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 having an uproarious good time at the Monastery: (14)
As of 2014-04-17 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (454 votes), past polls