I have a pm file that contains several subroutines. Following is the example of the script "myscript.pm":
sub a();
sub b();
sub c();
a(); #this can not be deleted in my situation in this pm file.
sub a() {
print 'a';
}
sub b() {
print 'b';
}
sub c() {
print 'c';
}
sub d() {
print 'd';
}
In the other script "running.pl", I would like to invoke c subroutine from myscript.pm. Following is the script:
use myscript qw(b);
b();
The result I get will be ab
. However, this is not my intention. I was expecting b
in the result. I wonder how I can invoke b subroutine from myscript.pm without running a();
?