* spelling fixes

* Why does using $&, $`, or $' slow my program down?
   + Anno Siegel updated the answer for recent speed 
   modifications
   

Index: perlfaq6.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq6.pod,v
retrieving revision 1.33
diff -u -d -r1.33 perlfaq6.pod
--- perlfaq6.pod  4 Jun 2005 04:12:40 -0000  1.33
+++ perlfaq6.pod  2 Aug 2005 22:24:57 -0000
@@ -603,7 +603,7 @@
   "Perler"  # no word char before P, but one after l
 
 You don't have to use \b to match words though.  You can look for
-non-word characters surrrounded by word characters.  These strings
+non-word characters surrounded by word characters.  These strings
 match the pattern /\b'\b/.
 
   "don't"   # the ' char is surrounded by "n" and "t"
@@ -633,14 +633,20 @@
 (contributed by Anno Siegel)
 
 Once Perl sees that you need one of these variables anywhere in the
-program, it provides them on each and every pattern match.  That means
-that on every pattern match the entire string will be copied, part of
-it to $`, part to $&, and part to $'.  Thus the penalty is most severe
-with long strings and patterns that match often.  Avoid $&, $', and $`
-if you can, but if you can't, once you've used them at all, use them
-at will because you've already paid the price. Remember that some
-algorithms really appreciate them.  As of the 5.005 release, the $&
-variable is no longer "expensive" the way the other two are.
+program, it provides them on each and every pattern match. That means
+that on every pattern match the entire string will be copied, part of
it
+to $`, part to $&, and part to $'. Thus the penalty is most severe with
+long strings and patterns that match often. Avoid $&, $', and $` if you
+can, but if you can't, once you've used them at all, use them at will
+because you've already paid the price. Remember that some algorithms
+really appreciate them. As of the 5.005 release, the $& variable is no
+longer "expensive" the way the other two are.
+
+Since Perl 5.6.1 the special variables @- and @+ can functionally
replace
+$`, $& and $'.  These arrays contain pointers to the beginning and end
+of each match (see perlvar for the full story), so they give you
+essentially the same information, but without the risk of excessive
+string copying.
 
 =head2 What good is C<\G> in a regular expression?

-- 
brian d foy, [EMAIL PROTECTED]

Reply via email to