I'd suggest using Exporter:
# Module1.pm package Module1; our %variable; use base 'Exporter'; our @EXPORT_OK = qw(%variable); %variable = ( foo => "foo" ); # Module2.pm package Module2; use Module1 qw(%variable); print $variable{foo};
However, if you plan to use this variable to exchange data between the modules, I'd suggest using subroutine arguments instead.
In reply to Re: our scope and packages
by betterworld
in thread our scope and packages
by jfrm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |