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().
In reply to Re: require, globals, and some various mayhem
by perrin
in thread require, globals, and some various mayhem
by GaijinPunch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |