use warnings;
use strict;
my $table1 = <
) {
chomp;
my ($id, $value) = split;
next if $id eq 'ID';
$values{$id}[$tableIndex] = $value;
}
++$tableIndex;
}
for my $id (sort keys %values) {
print "$id";
print ' ', $values{$id}[$_] || 0 for 0 .. $tableIndex - 1;
print "\n";
}