| Keywords related to classes and object-orientednessFind out the type of thing being referencedDaftar Isi - ref
Returns a non-empty string if EXPR is a reference, the emptystring otherwise. If EXPRis not specified, $_ will be used. The value returned depends on thetype of thing the reference is a reference to.Builtin types include: - SCALAR
- ARRAY
- HASH
- CODE
- REF
- GLOB
- LVALUE
- FORMAT
- IO
- VSTRING
- Regexp
If the referenced object has been blessed into a package, then that packagename 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";
- }
- unless (ref($r)) {
- print "r is not a reference at all.\n";
- }
The return value LVALUE indicates a reference to an lvalue that is nota variable. You get this from taking the reference of function calls likepos() or substr() . VSTRING is returned if the reference pointsto a version string. The result Regexp indicates that the argument is a regular expressionresulting from qr// . See also perlref. |
| |
|