Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: use vars vs our vs $main:: for $VERSION

by afoken (Chancellor)
on Sep 26, 2009 at 10:09 UTC ( [id://797669] : note . print w/replies, xml ) Need Help??

in reply to use vars vs our vs $main:: for $VERSION

use vars qw($VERSION);$VERSION=1.3; is needed only if you want compatibility with ancient versions of perl 5 (older than 5.6.0).

our $VERSION=1.3; works perfectly with any perl since 5.6.0 (released 9.5 years ago).

$main::VERSION=1.3; is just wrong, unless you want to set the VERSION of the main package. Did you mean $What::Ever::Package::VERSION=1.3;? That should work with every perl 5.x, but needs more typing.


Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: use vars vs our vs $main:: for $VERSION
by bv (Friar) on Sep 26, 2009 at 13:41 UTC

    Since the script is standalone (not a module), the $main::VERSION one isn't completely wrong, but I do understand that our is better, since it does the right thing if I am in package main or any other package. Thanks!

    print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))