Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Next from inner loop only works "most of the time"

by GrandFather (Saint)
on May 18, 2021 at 21:49 UTC ( [id://11132718]=note: print w/replies, xml ) Need Help??


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

I don't have an answer, but I have part of an answer - hash keys are not ordered and the order changes each time the script is run. Another observation is that characters in the target word that are not in the letter frequency hash cause uninitialized value warnings (but you'd have noticed those so I'm guessing it's not that).

I strongly recommend you post a complete runable example that demonstrates the problem. It may be that you find the issue along the way - that's not a bad thing (see I know what I mean. Why don't you?).

I agree with the others who have suggested loop variable should be named. The line $seen{$_}++ for (split //,lc $_); uses the default variable in two different roles. Are you trying to deliberately make your code obscure, or are you just "saving time" (see my current sig). If you need to revisit the code even once you have lost all the time you saved and more by not using named variables.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132718]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found