我传递了一个引用,我想知道它的类型。以此目的,
“ref”适用于无祝福的引用,但在有祝福的引用上它返回
它被祝福的包名。
$a=[];
print ref $a;
ARRAY
bless $a, 'mytype';
print ref $a;
mytype
我怎样才能得到类型?
最佳答案
use Scalar::Util 'reftype';
print reftype bless {}; # HASH
关于perl - 我如何获得受祝福的 ref 的类型? (数组|散列|标量),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/973324/