Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

perlman:lib:vars

by root (Monk)
on Dec 23, 1999 at 00:49 UTC ( [id://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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2024-03-28 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found