I suppose you could do something like this:
sub type { my $obj = shift; return $obj->isa('HASH') ? 'HASH' : $obj->isa('ARRAY') ? 'ARRAY' : $obj->isa('SCALAR') ? 'SCALAR' : die 'Not HASH, ARRAY or SCALAR'; } print type( bless \a ), "\n"; print type( bless [a] ), "\n"; print type( bless {a=>b} ), "\n"; print type( bless \*STDOUT ), "\n\n";
If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.
In reply to Re: How do I determine the underlying type of an Object?
by Coruscate
in thread How do I determine the underlying type of an Object?
by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |