The above will work if the value returned isn't actually blessed into a package; if that's a possibility, then you might want to check out isa() instead.my $val = func(); print "Reference to a HASH!\n" if ref($val) eq "HASH"; print "Reference to a ARRAY!\n" if ref($val) eq "ARRAY"; print "Reference to a SCALAR!\n" if ref($val) eq "SCALAR"; print "A non-reference SCALAR!\n" if not ref($val);
--
[ e d @ h a l l e y . c c ]
In reply to Re: hashes
by halley
in thread Detect and reset hashes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |