in reply to How does my work with a trailing conditional

Personally, I eschew the use of trailing conditionals, and I can see that using them with 'my' is pathological. Best to use the ternary conditional operator '?:' with 'my'.
sub foo { my $string = ($conditional1) ? 'appended stuff' : ''; $string .= 'more appended stuff' if ($conditional2); }
If you wanted your variable to remain undefined when the conditional is false, you can use:
my $var = ($conditional) ? 'assigned value' : undef;