Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Tie a hash of hashes?

by ikegami (Pope)
on Feb 02, 2006 at 20:24 UTC ( #527421=note: print w/replies, xml ) Need Help??

in reply to Tie a hash of hashes?

The problem:

You need to convert the hashes into Tie::IxHashes.

Solution 1:

You could traverse %data and convert the appropriate hashes.

Solution 2:

You could create a subclass of Tie::IxHash to override its method. When a hash reference is added to the hash, tie the referenced hash if it isn't already tied. Don't forget to untie when appropriate.

Update: Time for a break! Neither solution works, because the order is already lost by the time the hashes can be converted.

What you need to do is to override the behaviour of the hash constructor { ... } at compile time, and I don't see any simple ways of doing that. The complex ways are 1) use a source filter and 2) replace the Perl compiler by parsing the file yourself.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://527421]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2016-09-30 21:22 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (574 votes). Check out past polls.