diff options
author | brian d foy <bdfoy@cpan.org> | 2009-10-19 13:19:51 -0500 |
---|---|---|
committer | brian d foy <bdfoy@cpan.org> | 2009-10-19 13:19:51 -0500 |
commit | f12f5f55b96ab324ac99ca675d447de42611ad4e (patch) | |
tree | bcddde989006128da4e895fba875d86e2272075b /pod/perlfaq6.pod | |
parent | 34b80e25c2b4f9caa86740b592c7c7dfdc78f44e (diff) | |
download | perl-f12f5f55b96ab324ac99ca675d447de42611ad4e.tar.gz |
* Synced the perlfaq
The latest commit in https://github.com/briandfoy/perlfaq is
aa2b30a3bcbf1ac69f000fe363b0c384fbc44723
dated Thu Oct 15 20:01:45 2009 -0500
Diffstat (limited to 'pod/perlfaq6.pod')
-rw-r--r-- | pod/perlfaq6.pod | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod index daa8402e86..ea7dcb315d 100644 --- a/pod/perlfaq6.pod +++ b/pod/perlfaq6.pod @@ -713,7 +713,7 @@ X<regular expression, efficiency> ( contributed by brian d foy ) Avoid asking Perl to compile a regular expression every time -you want to match it. In this example, perl must recompile +you want to match it. In this example, perl must recompile the regular expression for every iteration of the C<foreach> loop since it has no way to know what $pattern will be. @@ -735,7 +735,7 @@ The C<qr//> operator showed up in perl 5.005. It compiles a regular expression, but doesn't apply it. When you use the pre-compiled version of the regex, perl does less work. In this example, I inserted a C<map> to turn each pattern into -its pre-compiled form. The rest of the script is the same, +its pre-compiled form. The rest of the script is the same, but faster. @patterns = map { qr/\b$_\b/i } qw( foo bar baz ); @@ -753,7 +753,7 @@ but faster. } In some cases, you may be able to make several patterns into -a single regular expression. Beware of situations that require +a single regular expression. Beware of situations that require backtracking though. $regex = join '|', qw( foo bar baz ); |