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

Re^3: Assign 2D-Arrays to a hash using a key

by aaron_baugher (Curate)
on Feb 22, 2012 at 01:35 UTC ( #955431=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Assign 2D-Arrays to a hash using a key
in thread Assign 2D-Arrays to a hash using a key

It may not be necessary, if your data is reliable enough that you know there will always be the same number of values in the same order for each key. But I still like the hash-of-hashes because it tends to be easier to remember key names than index numbers. For instance, which of these makes it easier to recognize what it contains?

$hash{key}{ip_address}; # or $hash{key}[1];

On the other hand, arrays are faster and use less memory than hashes, so if you're pressed for speed or resources, a hash-of-arrays may be the better solution.

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.

Comment on Re^3: Assign 2D-Arrays to a hash using a key
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2016-02-14 17:47 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (470 votes), past polls