if (ref($array[$i]) eq "ARRAY") { print "It's an array!"; } else { print "Not an array!"; }