in reply to require, globals, and some various mayhem
What you're missing is that those aren't globals. Variables declared with my() are lexical, not global, and the reason it works when the subs are defined within the same script is that the lexical variables and the sub are in the same scope.
What you should do is pass the variables to the sub. However, your globals approach will work, provided you declare the variables with our() instead of my().
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: require, globals, and some various mayhem
by GaijinPunch (Pilgrim) on Jun 06, 2009 at 06:54 UTC | |
by perrin (Chancellor) on Jun 06, 2009 at 12:50 UTC | |
by Marshall (Canon) on Jun 06, 2009 at 17:58 UTC |
In Section
Seekers of Perl Wisdom