in reply to substr help

It's not clear exactly where you expect your output to be. You're calling substr inside the loop, but throwing away the results, then putting the original string $dna into the @windows list.

Also, the third argument to substr is the number of characters you want; using 0 will always return an empty string. And in your loop, you're starting at 10 and stopping when the position is greater than the number of elements in @dna, but there's only one element in that list, so the loop never executes.

I think something closer to what you mean is:

use constant MOVEMENT => 3; use constant WINDOWSIZE => 10; my $dna = 'accatgagctgtacgtagcatctgagcgcgcatgactgtgactgacgtaggcagca'; my @windows=(); for (my $pos = 0; $pos <= (length($dna) - WINDOWSIZE); $pos += MOVEMEN +T) { push(@windows,substr($dna,$pos,WINDOWSIZE)); } print "@windows\n";