in reply to How does my work with a trailing conditional
If you wanted your variable to remain undefined when the conditional is false, you can use:sub foo { my $string = ($conditional1) ? 'appended stuff' : ''; $string .= 'more appended stuff' if ($conditional2); }
my $var = ($conditional) ? 'assigned value' : undef;
|
|---|