Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Simple question about foreach and my.

by Tyke (Pilgrim)
on Mar 27, 2001 at 18:53 UTC ( #67502=note: print w/ replies, xml ) Need Help??


in reply to Re: Simple question about foreach and my.
in thread Simple question about foreach and my.

You need to be very careful using this idiom, especially if you're hoing to embed loops. It's very easy to mix up which $_ belongs to which loop and create some horrendous problems.

In general I find it's better to name (and declare) the iteration variables unless it's really going to be a short loop (in which case I tend to use the statement modifier expr for (@array) in any case)


Comment on Re: Re: Simple question about foreach and my.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-12-25 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls