Change the number of regexes that you need to one via Regexp::Assemble reducing the inner loop from many to 1?
use Regexp::Assemble; my $ra = Regexp::Assemble->new; $ra->add( q{Sarnia Employees' Bargaining Association} ); $ra->add( q{Sarnia Municipal Administrative Employees' Assn} ); $ra->add( q{Sarnia Police Association} ); $ra->add( q{Sarnia Professional Fire Fighters} ); print $ra->re;
which yields a single regex:
(?^:Sarnia (?:(?:Municipal Administrative Employees' Ass|Employees' Bargaining Associatio)n|P(?:rofessional Fire Fighters|olice Association)))which you could always feed to ack.
Changed to q{} per AnomalousMonk's post. Thanks AnomalousMonk!
In reply to Re: How to efficiently search for list of strings in multiple files?
by clueless newbie
in thread How to efficiently search for list of strings in multiple files?
by stray_tachyon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |