[plug] scrabble regex

Ville Johansson hyksos at sparcy.hopto.org
Fri Jun 20 07:30:01 WST 2003


I'm not sure if there is a good regex for what you want. I think I'd use
letter count hashes or something like that. This is probably very inefficient, 
but I didn't come up with anything better:

foreach $letter (split /''/, $letters) {
  $myletters{$letter}++;
}

and this is the inefficient part:

foreach $word (@dict) {
  foreach $letter (split /''/, $word) {
    $dictletters{$letter}++;
  }
}

and then you compare the two hashes. Wow, it's been ages since I've
written any Perl.

-- 
Ville Johansson of  | ()  ascii ribbon campaign - against html mail   
Tammisaari, Finland | /\                        - against microsoft attachments 



More information about the plug mailing list