How does browsing work in Perl modules?
Okay, you have a lot of misconceptions that we can best solve by identifying your immediate problem and pointing out good resources.
b.pm should be:
package b;
our $f = 1;
1;
a.pl should be
use b;
print $b::f
do it all with perl -I. a.pl
Now read carefully perldoc
perlmod
.
Also read perldoc
strict
.
a source to share
You should start by reading the Perl modules in the manual: perldoc perlmod
on the command line, or go to http://perldoc.perl.org/perlmod.html .
a source to share
Short answer: most likely because you are using this code on a caseless filesystem where the module b
is requested loads the inline module b
. Your module is not loading at all. If you rename b
, you get the expected result.
The longer answer included many exercises for not following even minimal good practice and being denied.
a source to share