my $range = join '|', 5278..5391; my $number = 5300; print "Matched\n" if $range =~ /\b$number\b/;