当我尝试从另一个模块复制哈希时,Scalar找到了操作员所期望的位置

时间:2013-10-19 13:53:47

标签: perl hash

Scalar found where operator expected at /pgfs1/eng/hchian2/bin/soc/fc_net_tracer.pl line 158, near "%hash_build_db::$cblock"
        (Missing operator before $cblock?)
syntax error at /pgfs1/eng/hchian2/bin/soc/fc_net_tracer.pl line 158, near "%hash_build_db::$cblock"
Execution of /pgfs1/eng/hchian2/bin/soc/fc_net_tracer.pl aborted due to compilation errors.

我正在尝试从另一个模块复制哈希,但是这个问题错误阻止了我。

我用来引用我在hash_build_db.pm中创建的哈希的代码是

use hash_build_db;
%$cblock = %hash_build_db::$cblock;

1 个答案:

答案 0 :(得分:1)

那应该是

%$cblock = %hash_build_db::cblock;

如果cblock包中有hash_build_db哈希,并且$cblock是hashref。