in reply to looping through an array reference of hash reference
my @officialannotation = []; my @prodigalannotation = [];
Why are you assigning an array reference to $officialannotation[0] and $prodigalannotation[0]?
%findgene = ( "start" => $offcordinates[1], "stop" => $offcordinates +[0] ); $hash_ref = \%findgene;
Or just:
$hash_ref = { "start" => $offcordinates[1], "stop" => $offcordinates[ +0] };
@officialannotation = []; push @officialannotation, $hash_ref;
You are removing all previous elements of @officialannotation with the assignment, and you could just write that as:
@officialannotation = ( [], $hash_ref );
But why do you need the array reference as the first element? And because both %findgene and $hash_ref are at file scope the hash reference will always point to the same variable.
for $hash_ref ( @$officialannotation ) { while (my $start, $stop) = each %$hash_ref ) { for $hash_ref2 ( @$prodigalannotation) { while (my $start1, $stop2) = each %$hash_ref2 ) {
Because the first element of @officialannotation and @prodigalannotation are ARRAY references instead of HASH references you should be getting error messages here.
|
|---|