http://qs321.pair.com?node_id=11132724


in reply to Next from inner loop only works "most of the time"

I'd replace the whole inner loop with next if grep {$seen{$_} > $masterLetterFreq{$_}} keys %seen; giving:

use strict; use warnings; my @result = ('thew', 'trow', 'whew '); my %masterLetterFreq = ('w' => 1, 'h' => 1, 't' => 1, 'o' => 1, 'r' => 2, 'e' => 1); for my $word (@result) { my %seen; $seen{$_}++ for split //, lc $word; next if grep {$seen{$_} > $masterLetterFreq{$_}} keys %seen; print "$word\n"; next; }

which avoids the goto label nonsense and avoids silly flag twiddling. Note that this code often generates a warning, but I haven't seen it print 'whew '. There is something more going on in your real code that gets 'whew' printed, but we don't have that code or a sample we can run to reproduce that error.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond