Hello mlsmit10, and welcome to the Monastery!
The missing semicolon identified by toolic and kcott accounts for the first two error messages. The third arises because in the line:
$final_fragments{$final_fragment1} = $third_fragments[0];
the variable $final_fragment1 has not been declared. Likewise, the fourth error is due to the undeclared $final_fragment2 in the following line. In Perl, variables are designated by sigils (in this case, @ for an array and $ for a scalar), and variables with different sigils are different variables.1 So, e.g., $final_fragment1 is an entirely different variable to @final_fragment1, and unrelated to it.
I’m not sure what you were intending in these two lines. If you wanted the number of elements in each array, you would write:
$final_fragments{scalar @final_fragment1} = $third_fragments[0]; $final_fragments{scalar @final_fragment2} = $third_fragments[scalar @t +hird_fragments - 1];
Update: But on second thought, I think you meant to declare these variables as scalars:
my $final_fragment1 = $seqname."_".$i."_1"; my $final_fragment2 = $seqname."_".$i."_2"; $final_fragments{$final_fragment1} = $third_fragments[0]; $final_fragments{$final_fragment2} = $third_fragments[scalar @third_fr +agments - 1];
Hope that helps,
1See perldata#Variable-names:
Every variable type has its own namespace, as do several non-variable identifiers. This means that you can, without fear of conflict, use the same name for a scalar variable, an array, or a hash--or, for that matter, for a filehandle, a directory handle, a subroutine name, a format name, or a label. This means that $foo and @foo are two different variables. It also means that $foo[1] is a part of @foo, not a part of $foo. This may seem a bit weird, but that's okay, because it is weird.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Bioinformatics, Error: explicit package name
by Athanasius
in thread Bioinformatics, Error: explicit package name
by mlsmit10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |