我在一个文件中有一个模块,它导出一个作为数组引用的常量。我可以在其定义模块中使用该常量,但在导入后无法使用它。错误消息说Can't use bareword ("AR") as an ARRAY ref while "strict refs" in use at mod.pl line 28.
。
考虑这个演示代码:
#!/usr/bin/perl
require 5.018_000;
use warnings;
use strict;
package Test;
use warnings;
use strict;
BEGIN {
require Exporter;
our $VERSION = 1.00; # for version checking
# Inherit from Exporter to export functions and variables
our @ISA = qw(Exporter);
our @EXPORT = qw(); # exported by default
our @EXPORT_OK = qw(AR); # can be optionally exported
}
use constant AR => …
Run Code Online (Sandbox Code Playgroud)