The Scalar::Util module has a function 'reftype':
reftype EXPR
If EXPR evaluates to a reference the type of the variable referenced is returned. Otherwise "undef" is returned.
$type = reftype "string"; # undef $type = reftype \$var; # SCALAR $type = reftype []; # ARRAY $obj = bless {}, "Foo"; $type = reftype $obj; # HASH
Hugo
In reply to Re: What type are you? Mr Hash, Sir Array, or Miss Scalar?
by hv
in thread What type are you? Mr Hash, Sir Array, or Miss Scalar?
by Doraemon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |