No. What you are using is not really a range operator. Rather it is a pattern class. When you use [ ] you are telling the parser to find any character that appears between the [ ]. But it does not look for them in that order. It is just looking to see if any of those exist. As is, the regex will look for one single character out of the following characters:
0
-
1
What I would do is look for 1 to 3 digits, save them into a string, and then do a numeric comparison to see if they are <= 100.
my $string = "the is the number 87";
my ($num) = $string =~ /([0-9]{1,3})/;
if ($num <= 100) {
....
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.