if ($x >= 1 && $x <= 10) { print "Correct match"; } else { print "Incorrect"; } #### if ($x =~ /^([1-9]|10)$/) { # etc }