My interpration of your question is somewhat different from the responses posted thus far - it looks like you want to modify %innerhash, after saving a "reference" to it, and you fear (correctly) that the reference will also change.
The answer is that what you save should be a COPY, not a reference.
If the %innerhash is only one level deep (i.e. it is shallow), you can save a copy like this:
$hash {somekey} = {%innerhash}; # Shallow copy
Now, you are free to modify %innerhash, and $hash{somekey} will maintain it's original value.
IF %innerhash is more than one level deep, you will need to do a "deep copy" - search for that at this site if you need it.
My goal ... to kill off the slow brain cells that are holding me back from synergizing my knowledge of vertically integrated mobile platforms in local cloud-based content management system datafication.
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.