|Think about Loose Coupling|
Perl noob struggling to loop through an arrayby microkorg (Initiate)
|on Oct 24, 2012 at 15:08 UTC||Need Help??|
microkorg has asked for the
wisdom of the Perl Monks concerning the following question:
It needs to:
- Recognise a header line and capture the header name
- insert a newline into the DNAsequence at a pre-determined place (the "e" in this example)
- paste the header line before the newline, forming a new entry into the file
- increase a count on the header each time a new entry is made
Each time it finds a new header the count should reset. Hopefully, giving the output seen below:
I have managed to get the separate elements working (in a fashion) but I don't seem to be able to get it to work as one element (at the moment the "header capture" section and the "insert newline" section are completely independent. My code is as follows:
...and the section which "cuts" the DNA sequence at the appropriate section is:
The last 2 steps are just to tidy up the formatting as the output must be exactly in the format of my 2 examples at the top of this post.Help please!
Until then, I will get my head down and carry on trying!