Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Tie a hash of hashes?

by japhy (Canon)
on Feb 03, 2006 at 03:43 UTC ( #527530=note: print w/ replies, xml ) Need Help??


in reply to Tie a hash of hashes?

This is pretty much exactly what I created Tie::Autotie for.


Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart


Comment on Re: Tie a hash of hashes?
Re^2: Tie a hash of hashes?
by Anonymous Monk on Feb 03, 2006 at 15:51 UTC
    Is that module going to work in this situation?

    The module's description on CPAN says it doesn't work when creating a hash reference, which is what I'm doing, isn't it?


    When I try it with this code:
    use Data::Dumper; use Tie::Autotie 'Tie::IxHash'; tie %data, 'Tie::IxHash'; do "File"; print Dumper \%data;
    I get the following output:
    $VAR1 = { 'SomeStuff' => {}, 'SomeMoreStuff' => {} };
    Which seems to support the module's description that its not going to work in this situation.
      Tie::IxHash doesn't even work in that situation. The problem is that when you use a hash reference altogether -- that is, $hash{x} = { ... } -- you are creating a hash reference in Perl, and that is not "caught" by Tie::IxHash. You can't achieve the desired goal the way File is set up. You'll need to change it, no matter what you do.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2015-07-03 13:21 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 (53 votes), past polls