Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Populating a nested hash with itself?

by PhilHibbs (Hermit)
on Jul 06, 2005 at 14:52 UTC ( #472832=note: print w/ replies, xml ) Need Help??


in reply to Populating a nested hash with itself?

It seems to me that this code is building an arraya list, and then loading it into a hash. While building the arraylist, $hashref points to an empty hash.

I'm a little unsure what order things happen in behind the scenes, maybe hash assignment is done one entry at a time, so the first entry is created and added to the target variable so that the second entry can refer to it, but I doubt it.


Comment on Re: Populating a nested hash with itself?
Re^2: Populating a nested hash with itself?
by ikegami (Pope) on Jul 06, 2005 at 14:59 UTC
    I'm a little unsure what order things happen in behind the scenes, maybe hash assignment is done one entry at a time

    Parens have higher precedence than the assignment operator, so the list (nit: it's a "list", not an "array") is contructed before the assignment is performed. This isn't a hash constructor. There isn't such a thing in Perl. The code creates a list, which is then assigned to the hash.

      Yes, that's what my inner C programmer told me, but I don't trust Perl not to do some crazy magic (DWIMer?)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-08-30 02:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls