in reply to Rosetta code: Split an array into chunks
Stolen from brother BUK, our beloved former leader: print splice @a, 0, 5 for 1 .. 5; It rhymes somehow again! Not tested but I guess it works. I’m still on a mobile device and in a hurry.
See also Generate a # between 1 and 50 in groups of 5 as well as the sources of List::MoreUtils::PP:
sub natatime ($@) { my $n = shift; my @list = @_; return sub { return splice @list, 0, $n; } }
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
In Section
Meditations