Thanks to the strong suggestions of the good folks on this forum about the value of "use strict" I'm making the conversion of my existing code into use strict.

I've been on the -w bandwagon since day one so at least I don't have those potential messes to look forward to.

However, with the switch to use strict I'm not sure how to handle my globals.

I have three libraries I use for different purposes. I've included them into different scripts using "require". One of these libraries establishes about a dozen global vars that I expect to be floating around in all of my scripts.

Eventually I'll start using proper package::var type syntax. But at the moment I'd like to sneak up on that one script at a time.

Hence I'm looking at the use of "use var" or "our" to declare these globals in my libraries.

Is it true that both will work? Or will I lose scope when the program returns from the required library into the main script?

As you might guess I've been doing all my Perl on street corners and now I'm trying to learn it gooder. ;-)

Claude
p.s. If you know of a tutorial for "Strict after the fact" let me know.


In reply to "use vars" vs. "our" or Strict after the fact by Xxaxx

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.