> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 14, 2001 2:21 PM > To: [EMAIL PROTECTED] > 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?
I like your way. If you don't care about destroying the second array, you can do: push @$_, @{shift @$array2} for @$array1; Not as readable as yours, but earns a low golf score... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]