I guess you could do

for (0..$#{ $array1 }) {
  push( @{ $array1->[$_] }, @{ $array2->[$_] } );
} 

I'm not sure if that is any clearer or not.
-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 11/14/2001 1:21 PM
Subject: Array References - Concatenation

Friends,

I have two, two-dimensional array references, and I need to join the
rows of
each array.

$array1 = [
                        [11,12],
                        [21,22],
                        [31,32]
                  ];
and
$array2 = [
                        [18,19],
                        [28,29],
                        [38,39]
                  ];

I need to have the output as this:

11      12      18      19      
21      22      28      29      
31      32      38      39

Currently how I am doing this is like this:

$count  = 0;                    
foreach $row (@{$array2}) {
        push(@{$array1->[$count]}, @$row);
        $count++;
}

Is there a better, straightforward way to do this without creating extra
counters like what I have done?

Thanks,
Rex

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to