Help for this page

Select Code to Download


  1. or download this
    $a[$_] -= $b[$_] for 0..$#a;
    
  2. or download this
    $a[$_] -= $b[$_] for (),0..$#a;
    
  3. or download this
    map { $a[$_] -= $b[$_] } 0..$#a;
    
  4. or download this
    my $i = @a; $a[$i] -= $b[$i] while $i--;
    
  5. or download this
    my $i = @a;
    goto CHECK;
    BODY:  $a[$i] -= $b[$i];
    CHECK: goto BODY if $i--;
    
  6. or download this
    sub subarray {
        my ($a, $b) = @_;
    ...
    }
    
    subarray(\@a, \@b);
    
  7. or download this
    sub subarray {
        my ($a, $b) = @_;
    ...
    }
    
    subarray(\@a, \@b);
    
  8. or download this
    use List::MoreUtils qw( pairwise );
    @a = pairwise { $a - $b } @a, @b;