use strict; use warnings; my $array; if (ref $array eq 'ARRAY' && ref $array->[0] eq 'HASH' # checking if the contents of array ref is a hash ref ){ do something }