I am trying to match an array with the related value in the hash. Hash and array are opened and print fine but I can only get the match for one line not the complete array. Please help, I'm completely stuck and I keep hitting the same problem no matter how I write the rest.
my $Start_rank;
my @b;
my $line2;
my %hash;
my $Rank;
my $info;
while (<INFILE>) {
my $line=$_;
$line=~s/\s$//;
chomp($line);
my @a;
#my @a=split/\t/,$line;
($Rank, my $id, my $C, my $Position) = split /\t/, $line;
next unless $Rank=~/\d+/;
$info = $id . "\t" . $C . "\t" . $Position;
$hash{$Rank}= $info;
}
while (<INFILE2>) {
$line2=$_;
$line2=~s/\s$//;
chomp($line2);
my @b=split/\t/,$line2;
next unless $b[0]=~/\d+/;
$Start_rank = $b[1];
while (($Rank, $SNP_info) = each (%hash)) {
foreach ($line2) {
if ($Start_rank eq $Rank ) {
print "$Start_rank\t$info\t$b[2]\t$b[3]\t$b[4]\t$b[5]\t$b[6]\t$b[7]\t$
+b[8]\t$b[9]\n"; }
else {print "no match\n"; } } }}
I should get ~60 matches, instead I get one. Thank you for anything you can suggest.