Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^2: match two elements from an array in a rowby Kanji (Parson) |
on Aug 17, 2007 at 01:45 UTC ( [id://633200]=note: print w/replies, xml ) | Need Help?? |
Perhaps premature optimization, but I'd recommend switching your tests around so that you only look for matches of numbers you care about:-
(Note the addition of anchors in the regex so you don't accidentally match a pair of, say, 181s.) And if the number of numbers you're trying to matches is likely to grow or change often, it may be easier using a hash instead of a regex:-
--k.
In Section
Seekers of Perl Wisdom
|
|