Help for this page

Select Code to Download


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