Dan Muey wrote: > Howdy list. > I'm trying to one lineify this: > > my $guts = $firstchoice || ''; > if(!$guts && $use_second_choice_if_first_is_empty) { $guts = > $secondchoice; } > > Basically > my $guts = $firstchoice || $secondchoic || ''; > Would be perfect except I only want to let it use > $seconchoice if $use_second_choice_if_first_is_empty has a true value. > This does not work like I want but illustrates the goal if > you read it our loud. > my $guts = $firstchoice || $secondchoic if > $use_second_choice_if_first_is_empty || ''; > > Is that possible to do with one line?
$first || ($use_second && $second) || ''; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>