in reply to Minimal password check, again

It seems like Text::Ngrams is what you are looking for. n-grams are items of size n in a piece of data, and Text::Ngrams locates and counts all possible combinations.

A word of notice: The module only seems to have documented functions to return formatted data. You can access the internal data structure directly, though, but have too look around in the source a little. (basically its my %grams = %{$ng->{table}[2]}; to get the 2-grams (where $ng is the ngrams-object))

Hope this is of any help,
Mats