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