perl - Tie::IxHash ordered associative arrays in Hash of Hashes? -
How can I keep that order in which hash elements were added for the second version?
(hash of hash)
For example:
Use tie: IxHash; My% hash; Tie% hash, "tie :: IxHash"; My $ num (0 ..5) {$ hash {"firstwell $ num"} for ++; } My $ num (0 ..5) {$ hash {"firstly valid"} {"secondval $ num"} ++; } Print dumper (% hash);
On removing the result, the $ VAR14 entry order was not protected:
$ VAR1 = 'Firstwell'; $ VAR2 = 1; $ VAR3 = 'First Wall 1'; $ VAR4 = 1; $ VAR5 = 'First valve 2'; $ VAR6 = 1; $ VAR7 = 'Firstwal 3'; $ VAR8 = 1; $ VAR9 = 'First valve 4'; $ VAR10 = 1; $ VAR11 = 'First valve 5'; $ VAR12 = 1; $ VAR13 = 'First Wallyfx'; $ VAR14 = {'Second Val 5' = & gt; 1, 'Second Val 4' = & gt; 1, 'second val 2' = & gt; 1, 'Second Val 1' = & gt; 1, 'second val 3' = & gt; 1, 'second val 0' = & gt; 1};
I know that I can trick that example with some type of operation, but elements in my actual problem have not been numbered or no order can be given. . What is a simple function / operation for hash multi level sequence insertion?
Thanks,
Yodar.
Look, it automatically corresponds to the new hashes created by auto correction. Tiled :: IxHash.
Comments
Post a Comment