<?xml version="1.0" encoding="windows-1252"?>
<node id="989775" title="Re: Table Manipulation" created="2012-08-25 22:57:59" updated="2012-08-25 22:57:59">
<type id="11">
note</type>
<author id="957973">
BillKSmith</author>
<data>
<field name="doctext">
&lt;p&gt;
Array of arrays works well.  Build a line of table_3 (using array slices) when a match is found.
&lt;/p&gt;
&lt;c&gt;
use strict;
use warnings;
use Data::Dumper;
my @table_1 = (
    # A  B  C
    [ 1, 1, 1 ],
    [ 1, 0, 2 ],
    [ 0, 1, 3 ],
);
my @table_2 = (
    # A  P  Q  R
    [ 1, 1, 0, 1 ],
    [ 1, 0, 1, 0 ],
    [ 0, 0, 0, 1,],
);

my @table_3;
foreach my $row_of_1 (@table_1) {
    foreach  my $row_of_2 (@table_2) {
        if ( $row_of_1-&gt;[0] == $row_of_2-&gt;[0] ) {
            push @table_3, [@{$row_of_1}[1..2],@{$row_of_2}[1..3]];
        }
    }
}

print Dumper \@table_3;
&lt;/c&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-957973"&gt;
Bill
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
989730</field>
<field name="parent_node">
989730</field>
</data>
</node>
