A parenthetic note on debugging...

For the life of me I can't figure out what is wrong, I can run the above operation fine if I manually insert the DNA sequences into an array ...

It sometimes helps a lot to see just what data you have. If you had written debug statements like

use Data::Dumper; ... open(DNA3handle, $DNA3file); @DNA3 = <DNA3handle>; print Dumper \@DNA3; # what's actually in the array right now? ... open(DNA4handle, $DNA4file); @DNA4 = <DNA4handle>; print Dumper \@DNA4; # ditto ...
you might have gotten further down the "That's not what I want/expect. Why not? Oh, of course..." path to wisdom. Nothing wrong with asking questions, but it's usually much more satisfying to manage on your own. See Data::Dumper, which is core. (I prefer Data::Dump::dd() and friends, but it's not core.) See also toolic's Basic debugging checklist.

And a note about Best Practices...

In your OPed code, I see things like the use of global variables and filehandles, no checking of open operations. These are all officially Frowned Upon. An extensive (and expensive!) discussion of Perl best practices can be found in TheDamian's Perl Best Practices. Not everyone (to put it mildly!) agrees with every recommended BP, but a thoroughly developed rationale is given for each. Another good discussion of current best practices is in chromatic's Modern Perl (free download here).


Give a man a fish:  <%-{-{-{-<


In reply to Re: Splice an array into another array by AnomalousMonk
in thread Splice an array into another array by Smeb

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.