dexahex has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
What are the pros and cons of using multidimensional hash emulation compared to using hash of hashes?
Consider the following code:
%the_hash = ( empl_john_id => 13, empl_john_position => slave, empl_bob_id => 0, empl_bob_position => manager, client_fred_id => 2, client_fred_phone => 12345, client_goldman_id => 0, client_goldman_phone => 666 ); %the_hash2 = ( empl => { john => { id => 13, position => slave }, bob => { id => 0, position => manager } }, client => { fred => { id => 2, phone => 12345 }, goldman => { id => 0, phone => 666 } } }
Will %the_hash2 work faster for fetch/store operations.
Is there a generalized rule on this TIMTOWDI?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multidimensional hash emulation vs hash of hashes
by moritz (Cardinal) on Aug 18, 2011 at 15:30 UTC | |
|
Re: multidimensional hash emulation vs hash of hashes
by kennethk (Abbot) on Aug 18, 2011 at 15:36 UTC | |
by moritz (Cardinal) on Aug 18, 2011 at 15:52 UTC | |
|
Re: multidimensional hash emulation vs hash of hashes
by blue_cowdawg (Monsignor) on Aug 18, 2011 at 15:33 UTC | |
|
Re: multidimensional hash emulation vs hash of hashes
by NetWallah (Canon) on Aug 18, 2011 at 16:52 UTC | |
|
Re: multidimensional hash emulation vs hash of hashes
by locked_user sundialsvc4 (Abbot) on Aug 18, 2011 at 17:08 UTC |