sub default { my $v = shift; return defined $v ? $v : shift; } my $value = default(getConfigValue( "use_foo" ), 1);