in reply to Detect presence of numbers 1-9
unless ($str =~ tr/1-5//c){ print "Valid\n"; }else{ print "Invalid\n"; } [download]