use strict; use warnings; { package foo; sub new { bless {}, shift}; } my $foo = foo->new(); print "ref(foo) = ",ref($foo), "\n"; print "foo is a hash\n" if UNIVERSAL::isa($foo,'HASH'); my $bar = {a => 1}; # The following won't work # print "bar is a hash\n" if $bar->isa('HASH'); print "bar is a hash\n" if UNIVERSAL::isa($bar,'HASH');