Alternative content
sub k_mers { my ($sequence, $k) = @_; my $len = length($sequence); my @result = (); for (my $i = 0; $i <= $len-$k; $i++) { push(@result, substr($sequence, $i, $k)); } return @result; }