I appreciate your suggestion!

This very well could be the "solution to the problem".
And also explain why previous commands made a difference in the result.
A state dependent failure where what happened before affects what happens now.

My previous thinking of reproducing an entire session would have caused a "hard failure".
The issue is "previous state" dependent.

Thank you, Marshall

if ($line =~ /^\s*:([a-zA-Z]+)\s*$/) # new list of letters { $master_letter_list = lc $1; ## Force all letter lists to LOWE +R CASE only %master_letter_freq=(); ########### ADDED ########## for (split //,$master_letter_list) { $master_letter_freq{$_}++; } print "master_letter_freq:\n"; print Dumper \%master_letter_freq; ##################### }
Here is a new version of wm.pl:
use strict; use warnings; use Data::Dumper; # Word Master -- quick hack on 5/18/2021 # en-US.dic is a flat file of sorted words (about 150K words) open (my $fh, '<', 'en-US.dic') or die "can't find dictionary file: en +-US.dic"; my @dic = map{chomp; $_}grep {!/'/ and !/[A-Z]/}<$fh>; #no apostrophes + allowed #no proper nouns Rome (capit +al letters) $0 =~ m!([\w. ]+)\s*$!; print "Word Master ($1)\n"; #like wm.pl this allows renaming the pro +gram print "# Enter list of letters by using colon or semicolon followed by + the letters\n"; print "# example>:omdee\n"; print "# in pattern, use simple dash for single unknown letters\n"; print "# m-de would match \"mode\"\n"; print "# quit|exit|q to exit program\n"; print "\n"; my $line; my %master_letter_freq; my $master_letter_list =""; #could be repeated letters like ee,tt,etc while ( (print "list of letters or pattern: "),$line=<>, $line !~ /\s* +quit|exit|q\s*$/i) { next unless $line =~ /\S/; #skip blank lines chomp $line; my $cur_pattern; if ($line =~ /^\s*[:;]([a-zA-Z]+)\s*$/) # new list of letters { $master_letter_list = lc $1; ## Force all letter lists to LOWE +R CASE only %master_letter_freq = (); for (split //,$master_letter_list) { $master_letter_freq{$_}++; } #print "master_letter_freq:\n"; #print Dumper \%master_letter_freq; ##################### } elsif ($line =~ /^\s*([a-zA-Z-]+)\s*$/) #no leading ":" or ";", this + is a pattern { $cur_pattern = lc $1; # Force all patters to LOWER CASE only if ($master_letter_list eq "") { print "No master letter list exists -> can't run this patt +ern! Error!\n"; next; } my $regex = ''; for (split //, $cur_pattern) # gen regex { if ($_ ne '-' and !exists $master_letter_freq{$_}) { print "Pattern has a letter that's not in master list! + Error!\n"; next; } if ($_ eq '-') {$regex .= "[$master_letter_list]";} else {$regex .= "$_";} } my @result = grep{/^$regex$/i}@dic; # filter out any result that is proper noun or if the number o +f # times a letter is repeated is more than the number of times +it is # repeated in the master letter list # foreach (@result) { my %seen; $seen{$_}++ for (split //,lc $_); # print "Testing Result $_, seen histogram is:\n"; # print Dumper \%seen; my $no_print = 0; foreach (keys %seen) { $no_print++ if ($seen{$_} > $master_letter_freq{$_}); } print "$_\n" unless $no_print;; } } else { print "Illegal input line!\n"; } } __END__ C:\Users\xxxx\Documents\Dictionary\en-US\en-US>perl wm.pl Word Master (wm.pl) # Enter list of letters by using colon or semicolon followed by the le +tters # example>:omdee # in pattern, use simple dash for single unknown letters # m-de would match "mode" # quit|exit|q to exit program list of letters or pattern: ;otrwreh list of letters or pattern: --r-w threw throw list of letters or pattern: ---w thew trow list of letters or pattern: q C:\Users\xxxx\Documents\Dictionary\en-US\en-US>

Update:
I am using the improved code and so far no program issues have been found.
The words in these puzzles are just crazy!
list of letters or pattern: :lfseka
list of letters or pattern: --e
ale

The correct word was FAE!

"The most commonly accepted meaning of the word “fae” on the internet is that the word is a shortened abbreviation for the word “fairy.” “Fairy” in this sense meaning the mythical and playful, often mischievous, human-like woodland creatures from stories and legends."
Perl cannot help with wacko stuff like that!

Update:
I just started a new puzzle with :buepol
My very first guess was "bole" and it worked.
GEEZ!
my second guess was "plebe" - that didn't even count as a valid word! What ?!


In reply to Re^4: Next from inner loop only works "most of the time" by Marshall
in thread Next from inner loop only works "most of the time" by Marshall

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.