http://qs321.pair.com?node_id=90974


in reply to Hash/Array of Regular Expressions?

You can pre-compile a regular expression using the qr// quote-like operator:
#!/usr/bin/perl -w use strict; my @array = map { qr{$_} } ('^abcd', 'cd[ef]g', 'cat$'); while (<>) { chomp; foreach my $re (@array) { print "Matched $re\n" if m{$re}; } }