in reply to How to deal with undefined returned variables.
Russ mentioned that the // operator is in Perl 6, but in fact it is available in Perl 5.10:
This only puts 'sha1' in your config value if your $cfg->val returns undef or nothing.use 5.010; $CONFIG{HASHTYPE} = $cfg->val("MISC","HASHTYPE") // 'sha1';
Definitely a valuable addition to the language.
|
---|
In Section
Seekers of Perl Wisdom