in reply to Pass data to a Module

Insert usual lecture on the issues with using globals.

But sometimes it makes sense to export globals. If you want to, just follow the following template in your module:

package My::Module; use base 'Exporter'; @EXPORT_OK = qw( $foo some_sub @stuff ); use strict; use vars qw($foo @stuff); # Write your module here, using your variables and # defining functions for export. 1;
And now in your client script do:
use strict; use My::Module qw($foo some_sub @stuff); use vars qw($foo @stuff); # etc
Material you may want to look up. strict.pm and relatives for explanations of the sanity checks, Exporter is being used to export from one package to another, and Dominus' Coping With Scoping to understand why the variables were not being seen as shared in the first place.