http://www.perlmonks.org?node_id=609655


in reply to Re^7: Fold a list using map splices
in thread Fold a list using map splices

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $SPLITSIZE = 1 + int rand(6); my $len = int rand(20); printf "SPLITSIZE=%d, len=%d\n", $SPLITSIZE, $len; my @list = 1..$len; @list = map[splice @list, 0, $SPLITSIZE], 0..$#list/$SPLITSIZE; print Dumper(\@list);