Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Why am I getting the result only from 1st substring and not from substring 2 and 3 in using the do-until loop with while loop inside it?

by Eliya (Vicar)
on May 18, 2012 at 12:04 UTC ( #971290=note: print w/ replies, xml ) Need Help??


in reply to How can I get the correct results for substrings 2 and 3 in a do-until loop?

How can I correct the code in line 10 for while loop while (my $fm= substr ($DNA1,0,4)) {

If I'm understanding you correctly, you want to update the offset in that substr:

my $offs = 0; while (my $fm= substr($DNA1, $offs, 4)) { $offs += 4; ... }

or

for (my $offs=0; my $fm=substr($DNA1, $offs, 4); $offs+=4 ) { ... }

That would give you the 3 substrings "GGCT", "CTGC" and "GCGG".


Comment on Re: Why am I getting the result only from 1st substring and not from substring 2 and 3 in using the do-until loop with while loop inside it?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971290]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-07-30 02:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls