Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Populating a nested hash with itself?

by PhilHibbs (Hermit)
on Jul 06, 2005 at 14:52 UTC ( [id://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?

Replies are listed 'Best First'.
Re^2: Populating a nested hash with itself?
by ikegami (Patriarch) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found