in reply to Match range of number

I might be wrong but I don't think you can. The range operator - applies to ranges of characters (including numbers), not a range of numbers (unless the numbers are below 10). See perlre.
use strict; use warnings; while (my $line = <DATA>) { my $match = 0; chomp $line; if ($line =~ m/^X\((\d+)\)Y\((\d+)\)$/) { $match = 1 if ( $1 >= 0 && $1 <= 35 && $2 >= 22 && $2 <= 50); } ($match) ? print $line . q{ match} : print $line . q{ miss}; } __DATA__ X(0)Y(35) X(21)Y(49) X(55)Y(55) X(-1)Y(33)
$ perl -l 650946.pl X(0)Y(35) match X(21)Y(49) match X(55)Y(55) miss X(-1)Y(33) miss
--
Andreas