Thank you guys! Unfortunately the output is like incomplete. The file_a.txt has 2026 lines in the output I got only 926 lines. I need to have all the 2026 lines (with respective associated genes or a blank line if no association is reported). So that way probably does not work; may be another simple chainge in the script could do the job?

Code

#!/usr/bin/perl

use strict; use warnings;

my %ID;

open my $a_fh, '<', 'file_A.txt' or die "failed to open file_A.txt $!"; open my $b_fh, '<', 'file_B.txt' or die "failed to open file_B.txt $!";