use Scalar::Util qw( blessed reftype ); ... my $is_blah = blessed( $thing ) eq 'Some::Class' && $x == 3; ... my $r = reftype( $value ); if ( $r eq 'HASH' || $r eq 'ARRAY' ) { # Do something here }