http://www.perlmonks.org?node_id=701224

AKSHUN has asked for the wisdom of the Perl Monks concerning the following question:

I need to separate out some routines that I reuse on several perl programs. I want to put them all in an external .pl file that I can by some method include in others. For the sake of clarity I'll call the file with the separate routines the "Library" and the programs that need to call it "Client".

In the Library I want to have something like this.

$variable1 = #SOME CALCULATION

and I want the Client to do something like this...

my $variable1; require "./Library.pl"; print "$variable1\n";
When I try this, $variable1 doesn't get set properly in the Client program.
I know that the assignment in the Library works because if I print the variable in it, the value is correct.
I am not sure what I'm doing wrong.
Any suggestions?