use UNIVERSAL qw( isa ); .... my $is_blah = isa( $thing, 'Some::Class' ) && $x == 3; ... if ( isa($value, 'HASH') || isa($value, 'ARRAY') ) { # Do something here }