in reply to Re: working with multiple hash refs
in thread working with multiple hash refs

That is very broken. If a value appears more than once in the two hashes, then your code will discard all but one of the keys it is associated with. You can't just invert the hashes unless you know that all of the values are unique (or you don't care about losing data.)

Update: I was wrong. As jdporter explains below, he is not using values as keys. My apologies.

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Re: working with multiple hash refs

Replies are listed 'Best First'.
Re: Re: Re: working with multiple hash refs
by jdporter (Paladin) on Dec 20, 2002 at 01:02 UTC
    (Somehow I don't feel that posting nodes in a thread is the best way to have this kind of debate, but...)

    I don't know how to tell you gently that you are quite mistaken.
    I am only inverting two levels of keys of hashes. The values stay at the "leafs", where they were.

    In other words, given hash %a as     $a{foo}{bar} = value; I am creating an "inversion" of that hash, %b, as     $b{bar}{foo} = value; No potential for loss. No values being used as keys, nor vice versa.

    jdporter
    ...porque es dificil estar guapo y blanco.

      I don't know how to tell you gently that you are quite mistaken.

      There's no need to tell me gently. You are quite right. I was mistaken; your solution is fine. I did not thoroughly read your code. Please accept my apologies.

      -sauoq
      "My two cents aren't worth a dime.";