JockoHelios has asked for the wisdom of the Perl Monks concerning the following question:
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:
use vars ( $Date, $Time );
$Date = 0;
$Time = 1;
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use vars - how to use this
by 2teez (Vicar) on Jun 07, 2013 at 01:50 UTC | |
|
Re: use vars - how to use this
by NetWallah (Canon) on Jun 07, 2013 at 00:12 UTC | |
|
Re: use vars - how to use this (copy paste)
by Anonymous Monk on Jun 07, 2013 at 00:33 UTC | |
by JockoHelios (Scribe) on Jun 07, 2013 at 01:03 UTC | |
by Anonymous Monk on Jun 07, 2013 at 00:35 UTC |