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

NAME

6       vars - Perl pragma to predeclare global variable names
7

SYNOPSIS

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

DESCRIPTION

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