Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by mmartin (Monk)
on Feb 21, 2012 at 14:59 UTC ( #955326=note: print w/ replies, xml ) Need Help??


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

Hey aaron_baugher,

Thanks for the reply..!

Now that I think about, I guess I kinda gave a bad example. For the values that might be duplicated, they would be integers which "should" be added together and then stored into the hash. So I guess there wouldn't be a value that has more than one value for particular record.

With this new info do you still think it's necessary to do a hash of hashes still?

Thanks,
Matt



Comment on Re^2: Assign 2D-Arrays to a hash using a key
Re^3: Assign 2D-Arrays to a hash using a key
by aaron_baugher (Deacon) on Feb 22, 2012 at 01:35 UTC

    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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-12-25 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls