- or download this
$output[int($_/3)] += $arr[$_] for 0..@arr-1;
- or download this
my $k = @arr / 3;
for (0..$k) {
$output[$_] += $arr[3*$_] + $arr[3*$_+1] + $arr[3*$_ +2];
}
- or download this
my $k = @arr / 3;
my $b = 0;
...
$output[$_] = $arr[$b] + $arr[$b+1] + $arr[$b +2];
$b += 3;
}