use strict; use warnings; my $aref = [qw(1 2 3 4)]; if ( eval { %$aref; 1 } ) { print "aref is a href\n"; my %hash = %$aref; }