Think about Loose Coupling | |
PerlMonks |
How can I get the correct results for substrings 2 and 3 in a do-until loop?by supriyoch_2008 (Monk) |
on May 18, 2012 at 11:40 UTC ( [id://971284]=perlquestion: print w/replies, xml ) | Need Help?? |
supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question: Hi Perlmonks, I am a beginner in perl programming. My interest is to estimate a few values from three substrings within a string. The string is $DNA1="GGCT CTGCGCGGNN"; At first, I have removed the Ns and white spaces. I have written a code but it makes the cmd run continuously. However, the result output in text file on desktop shows correct results for the 1st substring (4 bases), although it does not show the results for substring 2 (CTGC) and substring 3(GCGG). The substrings are non-overlapping and adjacent to each other. How can I correct the code in line 10 for while loop while (my $fm= substr ($DNA1,0,4)) { so that I get the correct results for all the 3 substrings. I have given the code, the correct results that I have got for 1st substring and my expected results for all the substrings. Can any perlmonk help me correct the mistake in code? My code goes like
I have got the correct results for 1st substring: i.e.
My Expected Results are:
Back to
Seekers of Perl Wisdom
|
|