I'm using strict. I have a set of 11 defined values which are used by the main script, and all subroutines. The values don't change. They're mnemonics to specify the array location of fields. Example:

my $Date = 0; my $Time = 1;

I'm currently declaring this block of variables with slightly different names in each of the subroutine modules. Example from a module:

my $SRE_Date = 0; my $SRE_Time = 1;

I'd like to declare these globally in the main script, but avoid using :: notation, since this would be as verbose as my subroutine-specific naming scheme. Either way seems clunky, so I checked here for nodes on how to declare these globally. The clearest I could find was:
http://www.perlmonks.org/?node_id=22782
I then tried several different ways, and the best I can come up with is this:

use vars ( $Date, $Time );
$Date = 0; $Time = 1;

Placing that in my main script, I still get error messages like

Global symbol "$Date" requires explicit package name at Master.Pl line 13.

Putting it in a seperate module to use, I have run into this message:

Use of uninitialized value $_ in pattern match (m//) at C:/Perl/lib/vars.pm

I know I'm missing something which I'll likely spend an inordinate amount of time trying to decipher. If you've seen this before, or know how to declare variables globally using strict, I'd appreciate your input.

Dyslexics Untie !!!

In reply to use vars - how to use this by JockoHelios

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.