use B 'svref_2object'; use overload (); sub bad_idea { my $thing = shift @_; local $@; # Protect against $@ stomping return # Is a real hash reference eval { svref_2object( $thing )->isa( 'B::HV' ) } # Pretends to be a hash reference or ( overload::Overloaded( $thing ) and overload::Method( $thing, '%{}' ) ); }