in reply to Re^8: My globals are visable; but undef'ed
in thread My globals are visable; but undef'ed
Because if I have to type a variable name in two different files, my typo rate is fairly high. Therefore I really, really want to declare it in one file, and let strict.pm catch my typos everywhere else.But putting use vars($var) does not make any difference from putting our $var; at the top of the file for this, or as far as I know any other use. In other words, I just use our as a direct replacement for vars. And if you do, there really isn't any difference (except that vars has more awkward scope).
And I don't use attributes on global variables (I do use them on global subroutines, though).
update: or are you really adding to the same package from different files as much as that? I really do that once or twice a year.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: My globals are visable; but undef'ed
by tilly (Archbishop) on Jul 31, 2008 at 22:55 UTC | |
by Joost (Canon) on Jul 31, 2008 at 22:59 UTC | |
by tilly (Archbishop) on Jul 31, 2008 at 23:08 UTC | |
by Joost (Canon) on Jul 31, 2008 at 23:30 UTC | |
by tilly (Archbishop) on Aug 01, 2008 at 05:17 UTC |