|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: filtering an arrayby ww (Chancellor) |
| on Sep 02, 2012 at 01:50 UTC ( #991225=note: print w/ replies, xml ) | Need Help?? |
|
Alternate approach (with a little error checking, which I hope is so basic and transparent as to need no explanation): You might want to upend your thought process. Simply warn about any elements of your data that have "G" or "T" (and, as you'll see in the code below, any non-conforming data -- letters other'n ACTG; too many or few letters, etc.) and then next past them without saving. Save the desired elements (the digits) to your @positions array, only after substituting away any combinations of "A" and "C" and -- when you've processed all the data, spit out the positions that satisfy your criteria:
Output:
Done in babytalk, to some extent, to ensure clarity. Compare OP's questions about the Monks' responses, above.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||