in reply to Global symbol x requires explicit package name at main.pl
beanryu, I think you may have 2 separate issues:
1. Don't name your module "test". I think there's already a std module with that name.
2. You don't need to use Exporter. Just do this:
In MyTest.pm:
package MyTest; use Modern::Perl; # or strict, warnings our $x = 'hi';
and in main.pl:
use Modern::Perl; use MyTest; say $MyTest::x;
Finally, if main.pl fails to find MyTest.pm, you'll need a use lib 'path/to/your/modules' line before the use MyTest.
|
|---|