in reply to Bi-Directional Hash Lookup

What's wrong with 2 hashes?

Maybe a HoH is what you need?

my %bidir= ( column1 => { a => 'b', }, column2 => { b => 'a', }, );
So  $a= $bidir{'column2'}->{$b} will give you "the other" value.

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: Bi-Directional Hash Lookup
by PerlingTheUK (Hermit) on Oct 11, 2005 at 12:06 UTC
    The problem about HoH is that I regularly update the content. In which case both hashes need updating. I do not like the idea of doing that for both especially as I access and manipulate the data at several locations. I think I will pick a Class structure giving me a getA and a getB method. This will at least make sure that data of a HoH is consistent as long as my setColumn method is fine.

    Cheers,
    PerlingTheUK
      If you tie Skeeve's hash, you will have the chance to do sync when one of them updated...