in reply to Sharing Variables and Routines between modules

I agree with happy.barney about dependencies. I would not put other dependencies inside of My_Globals.pm.

Both $dbh and %globals are of course readily available in index.pl in their short form.

Maybe there is a misunderstanding here. If you define %globals in some package, and export that name, it exists anywhere that you have used the My_Globals.pm package and imported %globals (below it is exported implicitly to all "users").

You take out the my %globals=(...) stuff from index.pl. That initialization code now lives in the Globals.pm package. $globals{'a'}, I guess what you call the "short form" works in index.pl after it uses My_Globals.pm.

#/usr/bin/perl use strict; use warnings; use My_Globals; print "global a = $globals{'a'}\n"; __END__ prints: global a = 1 =========== file My_Globals.pm ======== #!/usr/bin/perl use strict; use warnings; package My_Globals; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; our $VERSION=1.0; our @ISA = qw(Exporter); our @EXPORT = qw(%globals); our @EXPORT_OK = qw(); our %globals = ( a => 1, b =>2); 1;