![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re: Assignment to a value only if it is definedby jettero (Monsignor) |
on Jan 20, 2010 at 12:01 UTC ( #818431=note: print w/replies, xml ) | Need Help?? |
If bar() is a complex function, then perhaps it should be the one returning the default value...
If that's not reasonable, then perhaps you need a default wrapper or something... Here's two ideas:
Or just do what the others said above (5.10+ only): $x = bar() // "default"; -Paul
In Section
Seekers of Perl Wisdom
|
|