my $end = int((length($dna) - 10)/3); for my $i (0..$end) { push @windows, substr($dna,$i*3,10); }