in reply to Re^5: My globals are visable; but undef'ed
in thread My globals are visable; but undef'ed
Here are the rules I follow. I use my unless there is a specific reason not to. I will use our for certain standard globals that need to be global, such as @EXPORT_OK. When I need to share variables across multiple files I try to use Exporter to export it from one place to all of the places that need it. If that solution won't work, then I will "use vars" for the declaration. I never use our for any variables that I've invented within my code.
I used to not use our for those standard globals. Instead I used to just initialize them before my use strict line. But it has been so long since anyone I care about has been using Perl 5.005 that I no longer worry about that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: My globals are visable; but undef'ed
by Joost (Canon) on Jul 31, 2008 at 22:02 UTC | |
by tilly (Archbishop) on Jul 31, 2008 at 22:37 UTC | |
by Joost (Canon) on Jul 31, 2008 at 22:49 UTC | |
by tilly (Archbishop) on Jul 31, 2008 at 22:55 UTC | |
by Joost (Canon) on Jul 31, 2008 at 22:59 UTC | |
|