in reply to matching between 1 to 8 digits but not more
if (m/\d{9,}/) { # more than 8 digits } elseif (m/\d/) { # 8 or less digits else { # no digits } [download]