Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Tie a hash of hashes?

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

in reply to Tie a hash of hashes?

I just need to search and replace '()' with '{}' and '=' with '=>'.

Instead of replacing
( ... )
{ ... }
replace it with
new_ordered_hash( ... )
and define new_ordered_hash as follows:

sub new_ordered_hash { my %ordered_hash; tie %ordered_hash, 'Tie::IxHash'; %ordered_hash = @_; return \%ordered_hash; }


Don't forget to untie the lower level hashes when appropriate.

Note: This falls under "2) parsing the file yourself", from my previous post.

Comment on Re: Tie a hash of hashes?
Select or Download Code
Replies are listed 'Best First'.
Re^2: Tie a hash of hashes?
by Anonymous Monk on Feb 02, 2006 at 22:19 UTC
    Ah, good thought. Initial testing looks promising.

    Thanks for the input!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2016-02-08 23:55 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (291 votes), past polls