Global symbol "****" requires explicit package name
下面是我写的perl script:
use strict;
my $irm_prop = ();
$irm_prop{"wo"} = "value";
run后出错:
Global symbol "%irm_prop" requires explicit package name at temp_2.pl line 6.
Execution of temp_2.pl aborted due to compilation errors (#1)
(F) You've said "use strict" or "use strict vars", which indicates
that all variables must either be lexically scoped (using "my" or "state"),
declared beforehand using "our", or explicitly qualified to say
which package the global variable is in (using "::").
这事我用了'use strict'后报的错,但是irm_prop是全局变量,为什么还会报错呢?
[解决办法]
你声明的是$irm_prop,而你使用的是%irm_prop,两者不是同一个变量。