in reply to stack array to array of arrays

spandox:

The best I came up with is:

my @t = (qw( a b c e 1 2 3 4 5 3 f )); my $len = 3; my @u = map {[ @t[$_ .. $_+$len-1] ]} grep {!($_%$len)} 0 .. $#t;

Fairly clear, but there's really no point in not using a well-named subroutine.

...roboticus

When your only tool is a hammer, all problems look like your thumb.