Actually, $g::TaskList is not used, named, or referred to in the entire module that the above code appears in (though it is global). (It is used by an upstream sub that calls down into this subroutine though, but wouldn't $_ at least be local to the subroutine?) Even if $_ somehow became an alias to a global variable that was not used in the module in question, how would using $_ as an r-value undef said global?
$Body .= $_;
How does that undef $_, or anything it might be aliasing to? Sorry if I'm not getting it (I understand the idea that making it local will fix it, but I'd like to understand what makes this not work in the first place, because I just cannot figure out how $_ became an alias to TaskList). Thanks for the continued attention. :)

In reply to Re^2: Side Effects by goodgulf
in thread Side Effects by goodgulf

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.