But your solution does basically the same and is not messy IMO. You could rewrite it as such:my $value=defined(getConfigValue("use_foo""))?getConfigValue("use_foo" +):1;
Which looks a bit better (and is more Perlish).my $value = getConfigValue( "use_foo"); $value=1 unless defined $value;
Please not that code provided is untested.
CU
Robartes-
In reply to Re: undef vs 0
by robartes
in thread undef vs 0
by skx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |