Hi Perlmonks,

I have a programming problem which I can't solve on my own and therefor Id like to ask for your help.

Earlier in the programm I read a complete inputfile via <STDIN>, process and split it in pieces and get something like a really big array of strings. Each string is a part of DNA, so it looks like "ATCGCAT..." (very long!). I can join the complete array into one string for further analysis of the DNA. But I also would like to do this:

1) Check every item of the array, starting with [0] if it passes an easy test (here: I just want to see, if the string of bases can be divided by 3 and therefor has the correct number for further analysis and transformation into aminoacids)

2) Join all strings in the array which passed the test into one big string (>6 mio. characters), letting out those which didn't pass (wrong number of bases).

3) Send some info to a logfile, which says something like this "Found x blocks (x = number of elemens in the array = $#array), joined y of them and left out z." The leftout parts should follow, like

Not used blocks# 1200 1500 5000 ...

I think it could be really easily solved, but right now I don't see the solution... :-(

Thank you very much for your help!

In reply to Analyse an array and join only some elements of it by Istirion

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.