in reply to Reference to hash tied with Tie::IxHash doesn't remember insertion order

The problem is that in populating %hash you string the tied hash out into a list and then copy that data into the new hash. But now you have a hash %hash which isn't tied.

The solution is to return the reference to the hash to a scalar like $h_ref and then do your lookups with:

foreach (keys %$h_ref) { print "$h_ref->{$_}\n"; }
  • Comment on Re (tilly) 1: Reference to hash tied with Tie::IxHash doesn't remember insertion order
  • Download Code