我有一个模块misc
可变$verbose
:
use strict;
use diagnostics;
package misc;
my $verbose = 1;
和模块mymod
其使用misc
:
use strict;
use diagnostics;
use misc;
package mymod;
sub mysub ($) {
...
($misc::verbose > 0) and print "verbose!\n";
}
其是,反过来,通过使用myprog
:
use strict;
use diagnostics;
use misc;
use mymod;
mymod::mysub("foo");
当我执行myprog
,我得到这样的警告:
Use of uninitialized value $misc::verbose in numeric gt (>) at mymod.pm line ...
我究竟做错了什么?