You need to process each table separately, same for rows:
foreach my $table ( $tree->findnodes('//table') ) {
foreach my $row ( $table->findnodes('.//tr') ) {
my @cells = $row->findvalues('.//td');
print join("\t", @cells), "\n";
}
print "\n";
}
Of course this is solution only for simple tables (think about columnspans, th, table inside table etc.)