Dan Muey wrote: > Howdy group, > > 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 ??
If you want your module to work with pre-5.6 perl, you don't have a choice - you can't use "our". What you lose when you go to "use vars" instead of "our" is: * minor speed improvements (our being implemented in the perl core, vars being in a module that does really l33t-type hacking to the perl global hash tables). * ability to scope your global variable to lexical scopes * readability - IMO, our is more readable than use vars qw(), and you can't use C<no vars> anyway, even though you may think you can. You have to decide if it's more important to move up with perl, or to support older versions of perl. For me, it's a no-brainer - I don't write for perl 5.005 anymore. For you ... the requirements can easily be different. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]