Why does your 'bad' run not show the %master_letter_freq hash like the 'good' run does?
Can there be some problem in the calculation of that hash?
Does the 'w' from the pattern get counted somehow?
Is the 'w' from the pattern already on the board? If so, with a 'w' on your 'rack', words should be allowed to have two 'w's.
As a side note, my favorite way of answering the question "What words can be made with these letters?"
is to match against a regex. Here's an example:
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11132707 use warnings; my $letters = 'otrwreh'; my $have = '...w'; # NOTE: using . instead of - my $pattern = join '', map "$_?", sort split //, $letters; my $regex = qr/^$pattern$/im; print "regex: $regex\n\n"; @ARGV = '/usr/share/dict/words'; /^$have$/i && (join '', sort /./g) =~ $regex && print while <>;
which outputs the computed regex and the matching words:
regex: (?^mi:^e?h?o?r?r?t?w?$) thew trow
this allows for only as many of a letter as initially specified.
In reply to Re: Next from inner loop only works "most of the time"
by tybalt89
in thread Next from inner loop only works "most of the time"
by Marshall
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |