use vars qw($frob @mung %seen);
This module predeclares all variables whose names are
in the list, allowing you to use them under
use strict
, and
disabling any typo warnings.
Packages such as the AutoLoader and SelfLoader that delay loading
of subroutines within packages can create problems with file-scoped lexicals
defined using
my
. This is because they move the subroutines outside
the scope of the lexical variables.
While the
use vars
pragma cannot duplicate the
effect of file-scoped lexicals (total transparency outside of the file),
it can act as an acceptable substitute by pre-declaring global symbols,
ensuring their availability to the routines whose loading was delayed.
See also the
subs
module.
[ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ]