in reply to multidimensional hash emulation vs hash of hashes
Will %the_hash2 work faster for fetch/store operations.
You can use Benchmark to find out.
There are two main advantages of nested hashes; the first is that there is no ambiguty if the separator character (here _) appears in the keys. The second is that you can easily extract hash refs of data that belong together. For example if you have a subroutine that on one person's data, you can just pass $the_hash2{client}{fred} to it, and it has all the data it needs to know about, and no more.
In terms of performance I can only guess that emulated hashes typically win by a close margin, but again that should be benchmarked.
|
|---|