> And if variable scoping would solve my percieved problem, > understand that the issue of my vs. local is something I > don't grok yet. I completely understand my, but local > escapes me.
Calling local on a list of variables modifies the values of those variables to be "local" to the current block, and to any subroutines called from within that block. It does this by saving the value of the variable before you called local, then restoring the value after the block has ended (or some variation on this; it may be more complex. :)

Take a look at perlsub (Temporary Values via local()) for a better explanation.

You also wrote:

> The odd thing is that I ran something like this, with > -w and use strict;, and it worked! Why? Should it have > worked?
Sure: what you did isn't illegal by any means, and in some circumstances, it's probably exactly what you want.

In reply to Re: Using $_ in nested loops by btrott
in thread Using $_ in nested loops by t'mo

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.