in reply to Re: How do I match a number range?
in thread How do I match a number range?
> my $range = join '|', 5278..5391; > my $number = 5300; > print "Matched\n" if $range =~ /\b$number\b/;
You want $number =~ /^($range)$/ instead.
Also, you need to create a potentially large list in memory then turn it into a large string. For numbers of this size, this isn't really a problem, but what if you are trying to match unix time values, that's 780k just to match a one day time frame.
In Section
Seekers of Perl Wisdom