#another twist sub split_to_n { my $n = shift; my @p = map {(@_)*$_/$n} -$n..0; map {[@_[$p[$_-1]..($p[$_]-1)]]} 1..$n; }