- or download this
sub do_something_with { print "@_\n"; }
my @elements = qw( a b c d e f g );
...
for my $i ($n-1 .. $#elements) {
do_something_with(@elements[($i-($n-1))..$i]);
}
- or download this
a b c
b c d
c d e
d e f
e f g
- or download this
a b c d
b c d e
c d e f
d e f g