Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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
( ... )
with
{ ... }
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; }

Untested.

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2015-07-29 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (261 votes), past polls