if( ($SRVCH =~ /\D/) # a non-digit || ($SRVCH > 22) # or greater 22 ||($SRVCH < 1) # or smaller than 1 ||($SRVCH =~ /(\s+)/) # or empty string (but see above) ||($SRVCH =~ /[a-zA-Z]/) # or a to z ){ ...