in reply to List into two-dimensional array
You could keep using splice and achieve your goal by using a sub.
sub group { my $n = shift; my @rv; push @rv, [ splice(@_, 0, $n) ] while @_; return @rv; } my @rv = group($C, @list);
Update: Woops! Fixed issue brought up by haukex in reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: List into two-dimensional array
by haukex (Archbishop) on Dec 14, 2020 at 19:13 UTC |