Introduction to mod_perl (part 4): Perl Basics - Making Variables Global With strict Pragma On (
Page 3 of 9 )
First you use :
use strict;
Then you use:
use vars qw($scalar %hash @array);
This declares the named variables as package globals in the current
package. They may be referred to within the same file and package
with their unqualified names; and in different files/packages with
their fully qualified names.
With perl5.6 you can use the our operator instead:
our qw($scalar %hash @array);
If you want to share package global variables between packages, here
is what you can do.