The real benefit of "our" is that it's block scoped. It's not "I know about this variable in the current package, let me access it directly wherever I am". It's rather "Excuse me? I'd like to access this 'global' variable over here without having to prepend the package name." Its effects are much more restricted (OK, this depends on the location of the "our" declaration). So you specifically CAN'T declare something in one file and have it affect the code in another, you can't declare somewhere that you intend to use a 'global' variable and silence all fatal errors for such named variables all over the place no matter whether on that other place you are aware of some global.
Of course if you declare all your globals on top of the file it doesn't matter much whether you use vars ... or our (...). But that's about as clever as declaring all variables with my (...) on top of the file. You can, but you should not.
I would rather our in this block and our in that block and stay "safe" elsewhere.
In reply to Re^13: the "our" declaration ?!! (special vars)
by Jenda
in thread the "our" declaration ?!!
by perlpal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |