Help for this page

Select Code to Download


  1. or download this
    $ perl -e 'my $i = 0; print $i++, " " while $i < 10;'
    0 1 2 3 4 5 6 7 8 9
    ...
    $ perl -e 'my @array = 1..10; print 2*$_, " " for @array;'
    2 4 6 8 10 12 14 16 18 20
    ~
    
  2. or download this
    for (@array) {
         print $ERRORS "Error: value $_ is negative\n" and next if $_ < 0;
         push @valid_vals, $_;
    }
    
  3. or download this
    5 statement if condition else other_statement;