sub mapAdj(&$@) { local( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j ); my( $code, $n ) = ( shift, shift ); map $code->( ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j ) = @_[ $_-$n .. $_ ] ), --$n .. $#_; } my @accum = mapAdj{ $a + $b + $c } 3, 1..10;