1vars(3pm)              Perl Programmers Reference Guide              vars(3pm)
2
3
4

NAME

6       vars - Perl pragma to predeclare global variable names (obsolete)
7

SYNOPSIS

9           use vars qw($frob @mung %seen);
10

DESCRIPTION

12       NOTE: For variables in the current package, the functionality provided
13       by this pragma has been superseded by "our" declarations, available in
14       Perl v5.6.0 or later.  See "our" in perlfunc.
15
16       This will predeclare all the variables whose names are in the list,
17       allowing you to use them under "use strict", and disabling any typo
18       warnings.
19
20       Unlike pragmas that affect the $^H hints variable, the "use vars" and
21       "use subs" declarations are not BLOCK-scoped.  They are thus effective
22       for the entire file in which they appear.  You may not rescind such
23       declarations with "no vars" or "no subs".
24
25       Packages such as the AutoLoader and SelfLoader that delay loading of
26       subroutines within packages can create problems with package lexicals
27       defined using "my()". While the vars pragma cannot duplicate the effect
28       of package lexicals (total transparency outside of the package), it can
29       act as an acceptable substitute by pre-declaring global symbols,
30       ensuring their availability to the later-loaded routines.
31
32       See "Pragmatic Modules" in perlmodlib.
33
34
35
36perl v5.10.1                      2009-02-12                         vars(3pm)
Impressum