<?xml version="1.0" encoding="windows-1252"?>
<node id="990525" title="Re: Help with pushing into a hash" created="2012-08-29 14:15:17" updated="2012-08-29 14:15:17">
<type id="11">
note</type>
<author id="918402">
2teez</author>
<data>
<field name="doctext">
Hi,
&lt;p&gt;
The script below could do want you want like so:
&lt;code&gt;
use warnings;
use strict;

my ( $file1, $file2 ) = @ARGV;

my $matched_word = {};

open my $fh, '&lt;', $file1 or die "can't open file: $!";
while (&lt;$fh&gt;) {
    s/^\s+?|\s+?$//;
    if (m{(.+?)\s+?.+?=(.+?)\s+?.*?$}) {
        push @{ $matched_word-&gt;{$1} }, $2;  
    }
}
close $fh or die "can't close file: $!";

open $fh, '&lt;', $file2 or die "can't open file: $!";
while (&lt;$fh&gt;) {
    s/^\s+?|\s+?$//;
    my ( $value1, $value2 ) = split /\s+?\|\s+?/, $_;
    print $value1, " ", @{ $matched_word-&gt;{$value1} }, " ", $value2, $/
      if exists $matched_word-&gt;{$value1};
}
close $fh or die "can't close file: $!";
&lt;/code&gt;
&lt;code&gt;
OUTPUT
Q197F8 IIV3-002R PF04947.9
Q91G88 IIV6-006L PF01486.12 PF00319.13
&lt;/code&gt;

Please, I need also point out some other things I think might be good you look out for&lt;br&gt;
1. Please, use 3 - arugment open function,&lt;br&gt;
2. Please, don't use "DATA" as your filehandles, it is used by perl, see [doc://SelfLoader],&lt;br&gt;
3. use lexical variable instead of BAREWORDs,&lt;br&gt;
4. You might not need Modern::Perl, since you have used &lt;code&gt;use warnings;use strict;&lt;/code&gt; or vise versa&lt;br/&gt;
&lt;/p&gt;</field>
<field name="root_node">
990508</field>
<field name="parent_node">
990508</field>
</data>
</node>
