Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Anagrams & Letter Banks

by Laurent_R (Canon)
on Oct 27, 2017 at 21:43 UTC ( [id://1202204]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Anagrams & Letter Banks
in thread Anagrams & Letter Banks

Basically, you have two loops in a row. In the first loop, each record is assigned to $_. When this loop is finished, $_ does not have any useful value. When you start the second loop, again, each value is assigned to $_.

No problem here, but there are cases, such as nested loops, where is might become slightly dangerous (you might clobber the value of the outer $_ with the value of the inner $_); in the cases of nested loops, while loops and for don't do exactly the same thing, so it is somewhat unreliable and don't do it unless you really know what you're doing. The best, in the event of nested loops, is to use explicit variables rather than the default topical variable $_.

On the questions related to your other project (not anagrams), you don't give enough details on what you need and how it is supposed to work. Please specify.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-23 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found