use strict.pm is "scoped" so that it won't affect another file, even if you include it with require and it doesn't have a package statement. That causes the two file scopes to share the same package globals. But they don't share non-global things such a my variables or the settings from use strict.pm.

Update: Also, use vars marks a variable as OK to strict.pm by tagging it as having been "imported". So use vars qw(%hash); "imports" %hash into the main:: package so that any use of %hash in the main:: package will not generate an error, even if that use was done from within another file.

our doesn't mark %main::hash as having been imported but instead makes a lexical %hash (much like what my %hash does) that is aliased to %main::hash. So this won't affect other files that use %hash while in package main::. If you put our inside a block, then it won't even affect uses of %hash outside of that scope (but this is often a bad idea).

        - tye (but my friends call me "Tye")

In reply to (tye)Re: our/my inconsistency. by tye
in thread our/my inconsistency. by boo_radley

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.