in reply to undef vs 0
Anyway, a contrived solution could be:
Perhaps a less vicious example:my($value) = map { defined() ? $_ : 1 } getConfigValue( "use_foo" );
You could always write a sub I suppose — perhaps in an external module, if you use it a lot?my $value = do { defined(local $_ = getConfigValue( "use_foo" )) ? $_ +: 1 };
sub default { my $v = shift; return defined $v ? $v : shift; } my $value = default(getConfigValue( "use_foo" ), 1);
|
|---|