Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Perl pragma to enable/disable ...Perl pragma to control VMS-spe ... (Berikutnya)
Pragmas

Perl pragma to predeclare global variable names (obsolete)

Daftar Isi

NAME

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

SYNOPSIS

  1. use vars qw($frob @mung %seen);

DESCRIPTION

NOTE: 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.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Perl pragma to enable/disable ...Perl pragma to control VMS-spe ... (Berikutnya)