$ perl -wE' my $condition = 0; say exists($ENV{BLAH}) || 0; local $ENV{BLAH} = $condition ? 42 : $ENV{BLAH}; say exists($ENV{BLAH}) || 0; ' 0 1