mesh_shortest#

Interleave multiple arrays, stopping at the shortest.

Synopsis#

my @out = mesh_shortest \@a, \@b, \@c;

What you get back#

A flat list containing elements at position 0 from each input, then 1, and so on — up to the length of the shortest input. No undef padding.

Examples#

my @r = mesh_shortest [1..3], ['a','b'];   # (1,'a', 2,'b')
my @r = mesh_shortest [1..3], [];          # ()

Differences from upstream#

Fully compatible with upstream.

See also#

  • mesh / mesh_longest — pad to longest instead.

  • zip_shortest — same lockstep walk, but yields one arrayref per row.