Help for this page

Select Code to Download


  1. or download this
    #! perl
    use strict;
    ...
    printf "Sum of all:      %d\n", sum0 @array;
    printf "Sum of positive: %d\n", sum0 @{ $part[1] };
    printf "Sum of negative: %d\n", sum0 @{ $part[0] };
    
  2. or download this
    17:47 >perl 1384_SoPW.pl
    Order of array:  -87 -51 -4 -1 1 3 4 7 47
    ...
    Sum of negative: -143
    
    17:47 >
    
  3. or download this
    for (@array){   #\sum of all numbers HERE  sumAll
        $sumAll +=$_;
    }
    
  4. or download this
    $sumAll += $_ for @array;