in reply to Parental Variables

Define your library as a module, using the use statement instead of a require statement.

Library:

package Subs; our $Foo = 3; sub foo { $Foo++; } 1;
Program:
use Subs; Subs::foo(); print $Subs::Foo, "\n";
If you want to then export the symbols &Subs::foo and $Subs::Foo to the main program, you add a little stuff to your library. The Exporter module helps you export certain symbols into the "parent" or calling scope.

Library:

package Subs; BEGIN { use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw($Foo &foo); } our $Foo = 3; sub foo { $Foo++ } 1;
Program:
use Subs; foo(); print $Foo, "\n";
For a lot more detail on this process, and other features, check out perlmod (or type perldoc perlmod at your console).

--
[ e d @ h a l l e y . c c ]