OK, if I understand well, what you need to do is to store the content of your tab separated file into a hash where the key would be the first column of each line of this file and the value the rest of the line (or the full line, or an array of the fields, whatever suits best your needs). Your tab separated file is relatively small and should fit into memory.
After having done that, you read your XML file and, for each node of interest, you look up the hash to see if the word exists. If it does, you retrieve the information from the corresponding value and update your XML content.
Pseudo-code for building the hash:
my %hash;
open my $TAB, "<", $tab_file or die "Cannot open $tabfile $!";
while (my $line = <$TAB>) {
my $key = (split /\t/, $line)[0];
$hash[$key] = $line;
}
close $TAB;
Then, when reading the XML file, you lookup the word of interest in the hash:
if (exists $hash{$xml_word}) {
my $line = $hash{$xml_word};
# now do what you want with $line
}
You could also preprocess the
$line when reading the tab separated file and store in the hash not the full line, but only the part of the data that you need, in a format that makes it easier to use (perhaps as an array ref, for example). Whether this is a good idea depends on your data (are you likely to user almost all entries of the TSV file, or only a few of them? Are you likely to use the TSV entries several times? and so on).