Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: create hash names dynamically

by citromatik (Curate)
on Jun 11, 2007 at 12:33 UTC ( [id://620484]=note: print w/replies, xml ) Need Help??


in reply to Re^2: create hash names dynamically
in thread create hash names dynamically

{} creates an empty reference to an anonymous hash. Then,
for my $num (@a) { push @hashes,{} }

Reads: For each element in the array @a, create a reference to an empty hash and store it in the array @hashes

It could be written more compact as in:

push @hashes,{} for (@a);

or

$hashes[$_-1]={} for (@a);

Hope this helps!

citromatik

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-28 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found