There may not be any good way to say this, but I'll take a stab at it.

When using my within a subroutine, it seems that the subroutine cannot share modified variable values with other subroutines unless the other subroutine is defined within the sub containing the my scoped valiable. Likewise, the my scoped value is not shared with the parent block unless the sub returns the value to the containing scope so that the desired modifications can be made. local is similar, but while the block where a local variable is defined or redefined is being parsed any subs that it triggers get to use the local value. If it were my variable then the subs would have whatever value they inherit from their own parent scope. If the variable is defined in the same block as the subroutines then my and local are effectively the same because the local scope is active as long as the subs are being defined and the subs inherit from my scope.


In reply to Re^4: Is use strict always appropriate? by Anonymous Monk
in thread Please help me print this hash. by Je55eah

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.