$flag ? $on : $off = $value;
####
$flag ? @array1 : @array2 = qw/This that the other/;
####
sub testthis {
$_[0] = "Hi mom.\n";
}
testthis ( $flag ? $yes : $no );
foreach ( $yes, $no ) {
print "$_\n" if defined $_;
}
####
my $condition = int rand 2;
my ( @array1, @array2 );
my $stuff = "This, that, and the other";
push( ( $condition ? @array1 : @array2 ), $stuff );
####
# First example; nothing gets assigned to @array;
my @array;
sub testthis {
@_ = qw/This that and the other/;
}
testthis ( @array );
# Second example; nothing gets assigned to @array1 or @array2.
# But no compiletime errors are generated either:
my $condition = int rand 2;
sub testthis {
@_ = qw/This that and the other/;
}
my ( @array1, @array2 );
testthis( $condition ? @array1 : @array2 );