3.2.121 ref
ref
The
ref
operator returns a true value if REF SCALAR ARRAY HASH CODE GLOB If the referenced object has been blessed into a package, then that package name is returned instead. You can think of ref as a "typeof" operator.
if (ref($r) eq "HASH") {
print "r is a reference to a hash.\n";
}
elsif (ref($r) eq "Hump") {
print "r is a reference to a Hump object.\n";
}
elsif (not ref $r) {
print "r is not a reference at all.\n";
}
See Chapter 4 for more details. |
|