I don't really understand how scoping works in Perl modules. This doesn't print anything. I would like it if running a.pl printed 1
b.pm
$f=1;
a.pl
use b;
print $f
OK, you have a lot of misconceptions that we can best address by fixing your immediate problem and pointing you to good resources.
b.pm should be:
package b;
our $f = 1;
1;
a.pl should be
use b;
print $b::f
run the whole thing with perl -I. a.pl
Now go read perldocperlmod very carefully.
Also read perldocstrict.
You should start off by reading about Perl modules in the manual: perldoc perlmod at the commandline, or go to http://perldoc.perl.org/perlmod.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With