Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Trouble with Tie::IxHash

by ikegami (Patriarch)
on May 23, 2006 at 18:42 UTC ( [id://551215]=note: print w/replies, xml ) Need Help??


in reply to Trouble with Tie::IxHash

Change
$hnr{'MAIN'} = { %list1 }; $hnr{'MAIN'}{'ZOP'} = { %list2 }; $hnr{'MAIN'}{'AP'} = { %list2 };
to
$hnr{'MAIN'} = \%list1; $hnr{'MAIN'}{'ZOP'} = \%list2; $hnr{'MAIN'}{'AP'} = \%list3;

{ %tied } creates a new (unordered) hash with a copy of %tied contents. That's not what you want,

Update: Alternatively, I think tying anon hashes is perfectly fine:

use Data::Dumper qw( Dumper ); use Tie::IxHash (); tie my %hnr, 'Tie::IxHash'; %hnr = ( ZOP => {}, AP => {}, Exit => undef ); tie %{$hnr{'MAIN'}{'ZOP'}}, 'Tie::IxHash'; tie %{$hnr{'MAIN'}{'AP'} }, 'Tie::IxHash'; my @zop_and_ap_init = ( Dev => undef, Con => undef, Test => undef, Exit => undef, New => undef, ); %{$hnr{'MAIN'}{'ZOP'}} = @zop_and_ap_init; %{$hnr{'MAIN'}{'AP'} } = @zop_and_ap_init; print Dumper(\%hnr);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found