如何判断Perl变量中的值是什么类型?
$ x可能是标量,对数组的引用或对散列(或可能是其他事情)的引用。
解决方法
ref():
Perl provides the
ref()
function so that you can check the reference type before dereferencing a reference…By using the
ref()
function you can protect program code that dereferences variables from producing errors when the wrong type of reference is used…