Subject: Having trouble using "strict"

Hello there!

I got a trouble (I think). I'd like to store some variables in a 
separated file ie vars.pl to have a possibility of using them in 
different scripts by 'require "vars.pl"'. So if I use some script using 
the variable $var1 = somevalue storing in 'vars.pl' and I call this 
variable with using 'strict' pragma I get error message - $var1 is 
unknown for this script of course because 'strict' is on; I must declare 
this with "my". But in this case I hade the value of this variable. How 
could I solve this trouble?

Thanks in advance.


See if this gives you some ideas...


#! /usr/local/bin/perl
use strict;
use lib "$ENV{HOME}/local/library";
require MyVars;
my $v1 = 'different Value';
print "$MyVars::v1\n";
print "$v1\n";

SUN1-BATCH>more ~/local/library/MyVars.pm
package MyVars;
        $v1='AAAAAAAA';
        $v2='BBBBBBBB';
SUN1-BATCH>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to