in reply to Obtain Key from Hash using value
This begs the question as to whether your data structure is appropriate. Perhaps your keys and values are backwards? Perhaps you have two sets of keys, and should therefore have two hashes?
my $person = { id1 => $id1, id2 => $id2, name => $name }; $persons_by_id1{$id1} = $person; $persons_by_id2{$id2} = $person; ... my $id2 = $persons_by_id1{$id1}{id2};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Obtain Key from Hash using value
by Jenda (Abbot) on Jul 07, 2010 at 10:37 UTC |