in reply to Trouble with Tie::IxHash
I have to read a text file and build a multiple level data structure and display in the same order it was read in.
I found that Tie::IxHash module can make that happen...
Ok, the question is why do you want to use Tie::IxHash. If you want to build an ordered structure why dont you use something like nested arrays of name=>value pairs.
$var=[ 'MAIN' => [ 'ZOP' => ['Dev', undef, 'Con', undef, 'Test', undef, 'Exit', undef, 'New', undef ], 'AP' => ['Dev', undef, 'Con', undef, 'Test', undef, 'Exit', undef, 'New', undef ], 'Exit' => undef, + ] ];
Unless you have some call to address these things by their names you dont need to use a hash at all. You can iterate over such a structure pretty much as as easily as with a HoH, and preserving the order read ceases to be an issue.
|
|---|