You could just add the new keys to the existing hash and make the same data serve both sets of keys:
I won't vouch for the purity of design, but it ought to be efficient, giving two views of the identical data. Updates from one view will be seen from the other.foreach my $user (keys %dateuserfile) { for (keys %{$dateuserfile{$user}}) { $dateuserfile{$_}{$user} = $dateuserfile{$user}{$_}; } }
Update: ichimunki, rewrite line 5 as $hash{bar}{foo} = $hash{foo}{bar};. You're copying the value by including the deepest key. Leave off that last key and you get a copy ot the reference to the hash where it lives.
After Compline,
Zaxo
In reply to Re: creating multiple views of a hash by reordering its key and values
by Zaxo
in thread creating multiple views of a hash by reordering its key and values
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |