Apart from the possibility that you have not chomped your incoming data, in your first test, the second and third elsifs cannot be executed. I suspect the rest of the tests are similarly flawed.
Refactoring:
if ($strand_hit eq "-") {
if ($strand_key ne "+") { # should this be eq ??
$upstream_exonic_antisense{$key} = $hit;
} elsif ($strand_key eq "-") {
$upstream_exonic_sense{$key} = $hit;
print "hola\n";
} elsif ($strand_key eq ".") {
$upstream_exonic_unknown{$key} = $hit;
}
} elsif ($strand_hit eq "+") {
if ($strand_key ne "-") { # should this be eq?
$downstream_exonic_antisense{$key} = $hit;
} elsif ($strand_key eq "+") {
$downstream_exonic_sense{$key} = $hit;
print "hola\n";
} elsif ($strand_key eq ".") {
$downstream_exonic_unknown{$key} = $hit;
}
} elsif ($strand_hit eq ".") {
$updown_exonic_unknown{$key} = $hit;
} else {
print $strand_key.$strand_hit."\n";
next;
}
Lets assume $strand_hit eq '-' for the moment. If $strand_key eq '+' none of the above if statements will be executed. The first statement will be executed for all other values of $strand_key
Now assume $strand_hit eq '-'. The first statement in the block of if elses is the only one that can be executed again.
I suggest you join the two values together and have if
statements for the two character string. It will be easier to read. Multiple elsifs with and clauses are the work of the devil...