my $in1 = $ARGV[0];
my $in2 = $ARGV[1];
my $fout = $ARGV[2];
####
open ONE, $in1;
open TWO, $in2;
open foutname, ">$fout";
####
open my $one, '<', $in1 || die "$in1: $!\n";
open my $two, '<', $in2 || die "$in2: $!\n";
open my $foutname, ">", $fout || die "$fout: $!\n";
####
my %first;
while (<$one>) {
chomp;
my @data = split /\t/;
$first{$data[0]}=$data[1]; # fill the hash with the values from the first file
}
close $one;
while (<$two>) {
chomp; # just search the hash for these strings
exists $first{$_} && print $foutname $first{$_},'\n';
}
close $two;
close $foutname || warn "$fout: $!\n';