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".
|
---|
In Section
Seekers of Perl Wisdom