Updates from one view will be seen from the other.
They will? I tried the following:
#!/usr/bin/perl -w
use strict;
my %hash;
$hash{foo}{bar}{x} = 'zoom!';
$hash{bar}{foo}{x} = $hash{foo}{bar}{x};
print "$hash{foo}{bar}{x}\n";
print "$hash{bar}{foo}{x}\n";
$hash{foo}{bar}{x} = '!mooz';
print "$hash{foo}{bar}{x}\n";
print "$hash{bar}{foo}{x}\n";
which outputs:
zoom!
zoom!
!mooz
zoom!
Now, if maybe I'm misunderstanding what your code does, but while it gives two separate views of the data, it does not create a duplicate set of references to a single set of data... if my calculations are correct it creates a second copy of the data with new references to the second copy. Changes to one copy will not affect the other.
update: my fault for not paying attention to details! Thanks for clarifying
zaxo. Of course, this is still less than optimal, since it would seem to make doing key reordering impossible for that last key (not that doing this was in the original requirements, but it's the kind of solution I'd be hoping for). Also, we do still have a potential key overwrite going on (think $hash{foo}{foo}{x}).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.