if ($array[0] eq (0+$array[0])) { # certainly IS a number } else { # might be a "string" number: # might contain extra space, or plus sign, # or extra zeroes, ... # Add more checking here if you need. }