How to include definitions from one Perl file to another?

Posted by oleg_repin on 2015-05-04 04:25

I believe this question has already been asked million times. And I spent significant time trying to find answer. No luck yet.

The simplest problem. I have some common value shared by several Perl scripts. Let it be
my $my_value = 12345;

Then in each script I would like to perform the code
print $my_value;

How to do it?

I created '' and '' files with the following content:
my $my_value = 12345;
I also tried
our $my_value = 12345;

Then I tried to use:
do '';
require '';
require common;
use common;
in my ''. Every time I just see some errors.

OK. I found unswer myself. Right code is following:
use lib '.';
use common;
print $my_value;