in reply to TwoWay hash modification
You don't want a two-way hash, you want two hashes that are kept in sync:
Now you can go find or write Tie::Hash::Complementary.my( %one, %two ); Tie::Hash::Complementary->marry( \%one, \%two ); $one{foo} = 'bar'; # Also sets $two{bar}= 'foo' $two{baz} = 'bif'; # Also sets $one{bif}= 'baz' $two{bar} = 'oof'; # Does: $one{oof} = delete $one{foo} $one{oof} = 'baz'; # Dies; $two{baz} can't be both oof and bif
Of course you can't have overlap between the keys with a single two-way hash. It is a single hash. You found a module that does something somewhat like what you want, but also fundamentally different than what you want.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: TwoWay hash modification (two hashes)
by shemp (Deacon) on Jun 25, 2003 at 19:22 UTC |