Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: How do I make an array of hashes?

by fx (Pilgrim)
on Dec 19, 2003 at 23:26 UTC ( #315948=categorized answer: print w/replies, xml ) Need Help??

Q&A > Data Structures > How do I make an array of hashes? - Answer contributed by fx

If the hash has already been created, you can store references to the hash in arrays:

push(@array, \%some_hash);

and then when you pop them off:

$hash_ref = pop(@array);

you'll get a scalar back which can be dereferenced to get at the values of the hash:

$value = $hash_ref->{'key'};

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2020-10-23 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (238 votes). Check out past polls.

    Notices?