I'm passed a reference, and I want to know its type. For this purpose, "ref" works on unblessed references, but on blessed references it returns the package name it was blessed with.
$a=[];
print ref $a;
ARRAY
bless $a, 'mytype';
print ref $a;
mytype
How can I get the type?
use Scalar::Util 'reftype';
print reftype bless {}; # HASH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With