Brethern,
I have a function, markFail, in some old code, which is hardcoded to writes value to a hash, %problemClassProps. In my new code, I'd like to write the same data to a different hash, %MEClassProps. Both hashes are global. I naively thought the following would work.
use strict; use vars qw( %problemClassProps %MEClassProps ); sub assign_ME_problem{ my($ontCategory, $ontNumbering, $mapwd) =@_; local(%problemClassProps) = %MEClassProps; markFail($mapwd, $ontCategory, $ontNumbering); 1}
When I come back from markFail, the info is in %problemClassProps, not %MEClassProps, and I lose it when I exit the scope of assign_ME_problem. I want to (locally) alias %MEClassProps to %problemClassProps. I looked through data::alias figuring it would tell me how, but no joy. I want to leave the old code alone. What's the right way to approach this?

thanks,
throop


In reply to Aliasing one hash to another by throop

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.