http://www.perlmonks.org?node_id=1038156


in reply to Re^4: Using Splice with Two Arrays within a loop
in thread Using Splice with Two Arrays within a loop

Now with death build in.

sub interleave_words { my @results = splice @_, shift; die "Arrays of different size\n" unless @results == @_; splice @results, 2*$_, 0, shift for 0..@results-1; return @results; }