| Hendrik Visage on Thu, 20 Feb 2003 16:21:08 +0200 (SAST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [Linux dev] Re: Perl and matching several regex's |
On Thu, Feb 20, 2003 at 04:07:16PM +0200, Oskar Pearson wrote: > Hi > > In the "Object Oriented Perl" book, there's mention of this; Is this a paper or electronic book? > the problem with doing it the easier way is that the perl system > checks the syntax of the regex every time it's used, is re-parsed, > and converted into perl's internal table-driven representation. :) I've found that just now while reading through the FAQs on this: http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq6/How_do_I_efficiently_match_many_regular_.html > He suggests using the qr operator (man perlop) As the above do to, but thanx for the snippet below, as that's exactly what I need :) > my %regexes = ( > qr /this is a test/ => \&one, > qr /this is another test/ => \&two, > ); Thanx Hendrik