in reply to Re: Find number of short words in long word
in thread Find number of short words in long word

The regex version is nice. This is more explicit:
sub scan_seq { my ($len, $seq) = @_; my %sub_seqs; if ($len > 0) { ++$sub_seqs{ substr($seq, $_, $len) } for 0 .. length($seq) - $len; } return \%sub_seqs; }

Update: Changed local our to my.