if (param()) { my $letters = param("letters"); my $action = param("select"); $results = param("results"); my $selectbox = param("selectbox"); print "Your letters were: $letters

"; ########### # any non a-z is a wild char ########### $blanks++ while $letters =~ s/[^a-z]//; $lhash{$_}++ for split //, $letters; ########################### # Open dictionary and begin checking word combos ########################### # dictionary opens, we get and find our words # words are placed in @solutions ############################# # At this point, we have our word list ############################# foreach my $found (@solutions) { my @chars = split(//, $found); # break word into chars my $score = 0; my $which_letter = $letters; # copy of letters to remove letters found. this will aid in finding the wild chars my @wilds; # wild chars used my $find = $found; # $found after we apply font changes to wild chars ############## # Break the word into characters and check which chars are wilds ############## foreach my $char (@chars) { if ($which_letter =~ m/$char/) { $which_letter =~ s/$char//; } else { push(@wilds, $char); } } ############# # tear word apart and get point value ############# my $found_word = $found; my $charlen = length $found; foreach(@wilds) { $found_word =~ s/$_//; } # removing the wilds my @found_word_letters = split(//, $found_word); foreach my $pt (@found_word_letters) { $score += $points{$pt}; } ##################################################### # # # WILD FILTERING HERE # # ##################################################### foreach my $wild (@wilds) { $find =~ s/$wild/$wild<\/font>/; } ################## # Remove words that don't follow user's wishes ################## if ($action eq "starts") { if ($find =~ m/^$selectbox/) { push @{$scored{$score}}, $find; push @{$bylength{$charlen}}, $find; } } elsif ($action eq "ends") { if ($find =~ m/$selectbox$/) { push @{$scored{$score}}, $find; push @{$bylength{$charlen}}, $find; } } else { push @{$scored{$score}}, $find; push @{$bylength{$charlen}}, $find; } #push( @wild, $which_letter ) unless( $which_letter =~ tr/$char//d ); }