foreach $pattern (@regexps) {
$c = eval "sub { /$re/ }"
or die "Can't compile $re";
push @subs, $c;
} |
while (<>) {
foreach $match (@subs) {
if (&$match) {
# matches
}
}
} |
| Forward to Perl-to-C compiler
Back to Compiled regexes Up to Stages of a Perl Programmer section index Up to YAPC 2000 course index |
YAPC 2000: Stages of a Perl Programmer - 49
Copyright © 2000, Nathan Torkington
|