我知道,我可以使用Exporter和@ EXPORT_OK/@ EXPORT来使用其他模块的子程序,但我怎样才能访问其他模块的变量? 另一个问题,在perl中,是否存在静态变量和非静态变量之间的区别?换句话说,我可以通过模块名称和模块引用来访问其他模块的变量吗?如何使用属于其他模块的变量?
例如 Module MyModule.pm;
package MyModule;
our $tmp=1;
sub new{
$this={};
bless $this;
return $this;
}
1;
perl的文件test.pl
Use MyModule;
我怎么访问test.pl的$ TMP?而且,如果我在test.pl中将$ tmp更改为2,如果我在另一个perl文件temp2.pl中访问它,结果如何?
http://stackoverflow.com/questions/3109672/how-to-make-a-hash-available-in-another-module – daxim