#!/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);
In reply to Re^8: Fold a list using map splices
by Anonymous Monk
in thread Fold a list using map splices
by hiseldl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |