Dan Muey wrote: > > In developing a module and I am torn. > > I want to use the newer our $variable; but to make it work > with pre 5.6 Perl (or whatever version our appeared in) I > have to do the use vars qw($variable); method > > So I was wanting some input about pros and cons of using > either since on the surface they appear to do the same thing > except that use vars is backwards compatable. > > Any input on our vs. use vars ?? Pro,con, neutral ??
Hi Dan. The main issue about 'our' as opposed to 'use vars' is that the of scope. 'use vars' compiles to a BEGIN block which, wherever it is used, makes the package variables visible throughout the file. An 'our' declaration provides access to a package variable up to the end of the current block or file. You can safely use 'our' in place of 'use vars', but not necessarily vice versa. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]