Right, I have facing the same problem too... and I just use this method to
overcome :

# globalVars.pl
use strict;
sub tellPath
{ my ($request) = @_;
   my %GlobalVars;

        $GlobalVars{PathA} = '/usr/bin/perl/';
        $GlobalVars{PathB} = '/usr/home/';
        .........

     if ($request) { return $GlobalVars{$request} }
    else { return %GlobalVars }
}


# Main.pl
use strict;
require "globalVars.pl";
my $pathA = tellPath('PathA');
my %AllPaths = tellPath( );


Somthing like that =)
But I think that should be a smarter way to deal with.
How would the list say ?

Rgds,
Connie



----- Original Message -----
From: "Rory O'Connor" <[EMAIL PROTECTED]>
To: "perl" <[EMAIL PROTECTED]>
Sent: Friday, July 12, 2002 1:24 AM
Subject: Global/local variable declaration


> I want to "use strict" in a script I'm writing.  I have a separate
> config file I am using (require "config.pl";) with a bunch of global
> variables.  But my script doesn't seem to want to recognize those
> variables unless they are actually declared in the body of the script
> itself.
>
> I tried using "my $variable = whatever;" in the config file but it
> didn't seem to work either.  Does this mean that if I use strict I can
> only use variables I declate in the script itself?
>
> Thanks,
>
> Rory
> --
> Rory O'Connor
> [EMAIL PROTECTED]
> Ph: 773.907.9101
> Cell: 773.398.4017
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to