The issue was that the Amp variable, when compared to the size of the others, would go OOB due to the way the $ID was referenced.
I fixed up the code by assigning a separate array for the variable, and then using a loop, like so
my @Amp = (); #Setting up a dynamic Array due to changes in amounts of
+ possible cell ID's
my @Amps = (); #Setting up a dynamic array for the sequences under the
+ IDs
my $n = (0); #Array spacer. Not a local variable; used later in execu
+tion.
my $file2 = shift;
open (FILE2, "$file2")|| die "Failed to open $file2 for reading : $!";
+ # Open first file
local $/= ">";
my $first=<FILE2>;
while (<FILE2>) { # Reading first hash
chomp;
my ($ID, $Seq) = split("\n");
$Amp[$n] = $ID; #Only need the ID. Sequence can be added to a dif
+ferent array in a similar fashion
$Seq =~ tr/acgt/ACGT/;
$Amps[$n] = $Seq; #As Above, but the sequence
$n++; #Increases array holder
}
close FILE2 || die "Failed to close $file2 : $!";
...
...
my $m = (0); #New variable to check against Amp
while ($m < $n){ #while there remain more Amp ID's to check. Not usin
+g <= due to how array and perl interact.
foreach my $ID (keys %bwa){ #for each ID
...
}
$m++;
}
I realize this isn't the prettiest solution, but its worked well enough with only two different "$ID" strings in input 2. If any monks know of a neater solution, please go ahead =)