ref EXPRSo, there's no need to call ->isa():
ref
Returns a true value if EXPR is a reference, false otherwise. If EXPR is not specified, $_ will be used. The value returned depends on the type of thing the reference is a reference to. Builtin types include:
SCALAR
ARRAY
HASH
CODE
REF
GLOB
LVALUE
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.
(untested)sub wants_foo_object { my $obj = shift; die unless $obj && ref($obj) eq "foo"; #... }
In reply to Re: How to differentiate hash reference and object reference?
by holli
in thread How to differentiate hash reference and object reference?
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |