Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^7: Hard syntax error or disambiguable parsing?

by merlyn (Sage)
on Feb 13, 2009 at 21:54 UTC ( [id://743717]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Hard syntax error or disambiguable parsing?
in thread Hard syntax error or disambiguable parsing?

How could I get the for loop to use the predeclared $i instead of using a local one?
You don't, and that's a good thing. (You mean "foreach loop" there, I presume.)
  • Comment on Re^7: Hard syntax error or disambiguable parsing?

Replies are listed 'Best First'.
Re^8: Hard syntax error or disambiguable parsing?
by NateTut (Deacon) on Feb 16, 2009 at 16:52 UTC
    Well I have run into occasions where I would like use a previously declared variable as the loop variable in a situation like this. I know I can always just set a predeclared variable to be equal to the local loop variable, but that seems messier to me. Don't get me wrong I really like the local loop variable feature I would just like to "turn it off" occasionally. I probably don't understand some basic concept here most likely...
        I think I misunderstood the issue. I tried to build a test script to illustrate but it didn't work as I expected (I was able to do what I said I couldn't earlier).

        When I ran into what I thought was this problem in the past it must have been something else.

        Sorry.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found