<?xml version="1.0" encoding="windows-1252"?>
<node id="73505" title="Re: Mixing up da Arrays (Golf)" created="2001-04-18 14:24:29" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="49324">
kschwab</author>
<data>
<field name="doctext">
I have no idea if this is quicker or more efficient,
but it's uglier:)&lt;p&gt;
&lt;code&gt;
#!/usr/bin/perl -w
use strict;
sub Mix;
my @Row1=(1,3,5,7);
my @Row2=(2,4,6);
my @Row3=(9,9,9);
my @Row4=Mix(\@Row1,\@Row2,\@Row3);
print "@Row4\n";
sub Mix {
   my @Result;
   for (0..scalar @{(sort {$#{$b} &lt;=&gt; $#{$a}} @_)[0]}) {
       foreach my $a (@_) {
           push(@Result,@$a[$_]) if ($_ &lt;= $#{$a});
       }
   }
   @Result;
}
&lt;/code&gt;
</field>
<field name="root_node">
73480</field>
<field name="parent_node">
73480</field>
</data>
</node>
