sub interleave { my @lists = map [@$_], @_; my @res; while (my $list = shift @lists) { if (@$list) { push @res, shift @$list; push @lists, $list; } } wantarray ? @res : \@res; }
In reply to Re (tilly) 1: interleaving lists
by tilly
in thread interleaving lists
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |