in reply to Multiple keys describing a single hash element
In these lines:
$new_client_hash{$new_key} = $clients{$old_key}; $new_client_hash{$old_key} = \$new_client_hash{$new_key};
$new_client_hash{$new_key} is already a reference so you are storing a reference to a reference to a hash. $clients{$old_key} is also a reference to a hash. If you store $clients{$old_key} in the new hash with both keys, they should both reference the same hash and your code should work with either key. Use this instead.
$new_client_hash{$new_key} = $new_client_hash{$old_key} = $clients{ +$old_key};
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
|
|---|