Hi all. Here's the problem I have: in my main application I declare a hash called returnVals. I call a subroutine &createExcelChart that passes the hash in as *returnVals. In the module (I've called the parameter returnVals and then returnValues to make it different than the calling program) I set the hash value of ExtendedName to a value and shortly after return to the calling program. When I print the value on the main (calling) program I don't get anything and it has no keys at that point. At the end of the module's subroutine I print the value and key fine. Can anyone suggest what I can do to solve this problem (which looks like a scope problem)? I have 2 other hashes used pretty much the same way (i.e. declared, passed to the sub, assigned, and returned) and they "seem" to work fine except those other 2 hashes are declared before calling the subroutine and their values remain unchanged in the sub. The values from these 2 hashes are accessed fine within the sub as well.

In reply to Scope of a Hash by Anonymous Monk

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.