use strict; use warnings; my $aref = [qw(1 2 3 4)]; if ( eval { %$aref; 1 } ) { print "aref is a href\n"; my %hash = %$aref; } #### if ( eval { my $foo = %$aref; 1 } ) { print "aref is a href\n"; my %hash = %$aref; } #### Pseudo-hashes are deprecated #### sub isa_hash { no warnings 'void'; my $hsh = shift(); return if eval { @$hsh; 1 }; return 1 if eval { %$hsh; 1 }; return; } sub isa_array { no warnings 'void'; my $arr = shift(); return 1 if eval { @$arr; 1 }; return; } #### if ( eval { 1 + %$possible_href } ) { return 1; }