I have a question related to Perl and scoping. I have a shared file with many different variables. I need a shared file in my main script, but I cannot access the variables; they seem to be outside its scope. I assumed that the ad will ourovercome this problem, but it doesn't seem to work.
Script 1: common.pl
our $var1 = "something";
our $var2 = "somethingelse";
Script 2: ftp.pl
use strict;
use warnings;
require('common.pl');
print $var1;
I get an error:
Global symbol "$ var1" requires explicit package name
source
share