Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Scope when initializing with references in a loop

by IraTarball (Monk)
on Dec 06, 2001 at 03:57 UTC ( #129810=note: print w/replies, xml ) Need Help??


in reply to Re: Scope when initializing with references in a loop
in thread Scope when initializing with references in a loop

*why* one wd do this)
It might be hard to see with this example, but the actual code has 'nodes' defined, each with references to it's "neighbors". The reference seemed clean because I could get at the values I want without having to figure out what the indices are for all of my neighbors. For this array it may seem trivial, but imagine an array of n dimensions.

the snag I see is that the first couple of times round the loop $array[1] is undefined.
This doesn't seem to matter. I was carefull to post the code in a way that the "d/l code" link would give you the actual code I'm referring to. If you do, and you run it, the array values all get initialized in the outer most scope by first. Still, in the loop, I seem to get a reference to some new value.

Ira,

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2019-07-17 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?