This is a very bad plan. You will almost always want to factor out most of the code to modules. Bringing everything in to be a monolithic script usually fails the sniff test.
As for your issues ... that's because "use" does a bunch of work behind the scenes for you. The important item that's missing is calling the import() function. So, you could hack it up as follows:
use Foo qw( foo bar ); ---- becomes ---- package Foo; # stuff here ... package main; Foo->import( qw( foo bar ) );
As I said before, I strongly recommend against this course of action, but, as usual, it's possible to do stupid things.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
In reply to Re: Global variable declarations with packages
by dragonchild
in thread Global variable declarations with packages
by spoulson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |