shemp has asked for the wisdom of the Perl Monks concerning the following question:
This results in the error:my %hash = tie( ('a' => 1), 'IxHash' );
Can't modify constant item in tie at tie_test.pl line XX, near "'IxHash')"
So im guessing that tie() must have a non-anonymous hash (or other data struct, depending on the tie). That makes sense, but i'd really like to do something like the following:
my %big_hash = ( 'part_1' => tie( %{...}, 'MyTie'), 'part_2' => tie( %{...}, 'MyTie'), ... );
I know that i could do something like:
But that isnt what i want to happen. Im almost certain that this cannot be done like i want, but i thought i'd ask.tie my %part_1, 'IxHash'; # set values for %part_1 tie my %part_2, 'IxHash'; # set values for %part_2 # ... my %big_hash = ( 'part_1' => \%part_1, 'part_2' => \%part_2, ... );
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tieing anonymous hashes
by davido (Cardinal) on Jun 28, 2005 at 20:41 UTC | |
by diotalevi (Canon) on Jun 28, 2005 at 22:26 UTC | |
by davido (Cardinal) on Jun 28, 2005 at 22:39 UTC | |
by diotalevi (Canon) on Jun 28, 2005 at 22:52 UTC | |
|
Re: Tieing anonymous hashes
by ikegami (Patriarch) on Jun 28, 2005 at 20:35 UTC | |
|
Re: Tieing anonymous hashes
by Arunbear (Prior) on Jun 28, 2005 at 22:04 UTC | |
|
Re: Tieing anonymous hashes
by shemp (Deacon) on Jun 28, 2005 at 20:48 UTC |