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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.