Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

perlman:lib:vars

by root (Scribe)
on Dec 23, 1999 at 00:49 UTC ( #1150=perlfunc: print w/ replies, xml ) Need Help??

lib:vars

See the current Perl documentation for lib:vars.

Here is our local, out-dated (pre-5.6) version:


vars - Perl pragma to predeclare global variable names



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



This will predeclare all the variables whose names are in the list, allowing you to use them under ``use strict'', and disabling any typo warnings.

Unlike pragmas that affect the $^H hints variable, the use vars and use subs declarations are not BLOCK-scoped. They are thus effective for the entire file in which they appear. You may not rescind such declarations with no vars or no subs.

Packages such as the AutoLoader and SelfLoader that delay loading of subroutines within packages can create problems with package lexicals defined using my. While the vars pragma cannot duplicate the effect of package lexicals (total transparency outside of the package), it can act as an acceptable substitute by pre-declaring global symbols, ensuring their availability to the later-loaded routines.

See perlmodlib.


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2014-07-30 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (234 votes), past polls