Help language development. Donate to The Perl Foundation

vars cpan:ELIZABETH last updated on 2018-06-04


Build Status


vars - Port of Perl 5's pragma to predeclare variables to Perl 6


use vars <$frob @mung %seen>;


This will predeclare all the subroutine whose names are in the list, allowing you to use them without parentheses even before they're declared.

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

See "Pragmatic Modules" in perlmodlib and "strict vars" in strict.


Due to the nature of the export mechanism in Perl 6, it is impossible (at the moment of this writing: 2018.05) to export to the OUR:: stash from a module. Therefore the Perl 6 version of this module exports to the lexical scope in which the use command occurs. For most standard uses, this is equivalent to the Perl 5 behaviour.


Elizabeth Mattijsen [email protected]

Source can be located at: . Comments and Pull Requests are welcome.


Copyright 2018 Elizabeth Mattijsen

Re-imagined from Perl 5 as part of the CPAN Butterfly Plan.

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.