PragmasPerl pragma to predeclare global variable names (obsolete)Daftar Isi NAMEvars - Perl pragma to predeclare global variable names (obsolete) SYNOPSIS- use vars qw($frob @mung %seen);
DESCRIPTIONNOTE: For variables in the current package, the functionality providedby this pragma has been superseded by our declarations, availablein Perl v5.6.0 or later. See our. This will predeclare all the variables whose names are in the list, allowing you to use them under "use strict", anddisabling any typo warnings. Unlike pragmas that affect the $^H hints variable, the use vars anduse subs declarations are not BLOCK-scoped. They are thus effectivefor the entire file in which they appear. You may not rescind suchdeclarations with no vars or no subs . Packages such as the AutoLoader and SelfLoader that delayloading of subroutines within packages can create problems withpackage lexicals defined using my() . While the vars pragmacannot duplicate the effect of package lexicals (total transparencyoutside of the package), it can act as an acceptable substitute bypre-declaring global symbols, ensuring their availability to thelater-loaded routines. See Pragmatic Modules in perlmodlib. |