Make a dummy OPpPAD_STATE and a dummy PL_unitcheck_save available to
[p5sagit/p5-mst-13.2.git] / pod / perlop.pod
index 3a8de2a..7b84a68 100644 (file)
@@ -266,8 +266,16 @@ C<$a> minus the largest multiple of C<$b> that is not greater than
 C<$a>.  If C<$b> is negative, then C<$a % $b> is C<$a> minus the
 smallest multiple of C<$b> that is not less than C<$a> (i.e. the
 result will be less than or equal to zero).  If the operands
-C<$a> and C<$b> are floting point values, only the integer portion
-of C<$a> and C<$b> will be used in the operation.
+C<$a> and C<$b> are floating point values and the absolute value of
+C<$b> (that is C<abs($b)>) is less than C<(UV_MAX + 1)>, only
+the integer portion of C<$a> and C<$b> will be used in the operation
+(Note: here C<UV_MAX> means the maximum of the unsigned integer type).
+If the absolute value of the right operand (C<abs($b)>) is greater than
+or equal to C<(UV_MAX + 1)>, "%" computes the floating-point remainder
+C<$r> in the equation C<($r = $a - $i*$b)> where C<$i> is a certain
+integer that makes C<$r> should have the same sign as the right operand
+C<$b> (B<not> as the left operand C<$a> like C function C<fmod()>)
+and the absolute value less than that of C<$b>.
 Note that when C<use integer> is in scope, "%" gives you direct access
 to the modulus operator as implemented by your C compiler.  This
 operator is not as well defined for negative operands, but it will
@@ -438,7 +446,7 @@ argument.
 X<cmp>
 
 Binary "~~" does a smart match between its arguments. Smart matching
-is described in L<perlsyn/"Smart Matching in Detail">.
+is described in L<perlsyn/"Smart matching in detail">.
 This operator is only available if you enable the "~~" feature:
 see L<feature> for more information.
 X<~~>
@@ -1059,7 +1067,7 @@ X<m> X<operator, match>
 X<regexp, options> X<regexp> X<regex, options> X<regex>
 X</c> X</i> X</m> X</o> X</s> X</x>
 
-=item /PATTERN/cgimosx
+=item /PATTERN/cgimosxk
 
 Searches a string for a pattern match, and in scalar context returns
 true if it succeeds, false if it fails.  If no string is specified
@@ -1072,13 +1080,15 @@ is in effect.
 
 Options are:
 
-    c  Do not reset search position on a failed match when /g is in effect.
-    g  Match globally, i.e., find all occurrences.
     i  Do case-insensitive pattern matching.
     m  Treat string as multiple lines.
-    o  Compile pattern only once.
     s  Treat string as single line.
     x  Use extended regular expressions.
+    g  Match globally, i.e., find all occurrences.
+    c  Do not reset search position on a failed match when /g is in effect.
+    o  Compile pattern only once.
+    k  Keep a copy of the matched string so that ${^MATCH} and friends
+       will be defined.
 
 If "/" is the delimiter then the initial C<m> is optional.  With the C<m>
 you can use any pair of non-alphanumeric, non-whitespace characters
@@ -1441,7 +1451,7 @@ put comments into a multi-line C<qw>-string.  For this reason, the
 C<use warnings> pragma and the B<-w> switch (that is, the C<$^W> variable)
 produces warnings if the STRING contains the "," or the "#" character.
 
-=item s/PATTERN/REPLACEMENT/egimosx
+=item s/PATTERN/REPLACEMENT/egimosxk
 X<substitute> X<substitution> X<replace> X<regexp, replace>
 X<regexp, substitute> X</e> X</g> X</i> X</m> X</o> X</s> X</x>
 
@@ -1467,13 +1477,16 @@ when C<use locale> is in effect.
 
 Options are:
 
-    e  Evaluate the right side as an expression.
-    g  Replace globally, i.e., all occurrences.
     i  Do case-insensitive pattern matching.
     m  Treat string as multiple lines.
-    o  Compile pattern only once.
     s  Treat string as single line.
     x  Use extended regular expressions.
+    g  Replace globally, i.e., all occurrences.
+    o  Compile pattern only once.
+    k  Keep a copy of the original string so ${^MATCH} and friends
+       will be defined.
+    e  Evaluate the right side as an expression.
+
 
 Any non-alphanumeric, non-whitespace delimiter may replace the
 slashes.  If single quotes are used, no interpretation is done on the
@@ -1507,7 +1520,7 @@ Examples:
 
     s/%(.)/$percent{$1}/g;     # change percent escapes; no /e
     s/%(.)/$percent{$1} || $&/ge;      # expr now, so /e
-    s/^=(\w+)/&pod($1)/ge;     # use function call
+    s/^=(\w+)/pod($1)/ge;      # use function call
 
     # expand variables in $_, but dynamics only, using
     # symbolic dereferencing
@@ -1570,7 +1583,7 @@ its own pair of quotes, which may or may not be bracketing quotes,
 e.g., C<tr[A-Z][a-z]> or C<tr(+\-*/)/ABCD/>.
 
 Note that C<tr> does B<not> do regular expression character classes
-such as C<\d> or C<[:lower:]>.  The <tr> operator is not equivalent to
+such as C<\d> or C<[:lower:]>.  The C<tr> operator is not equivalent to
 the tr(1) utility.  If you want to map strings between lower/upper
 cases, see L<perlfunc/lc> and L<perlfunc/uc>, and in general consider
 using the C<s> operator if you need regular expressions.
@@ -1972,20 +1985,15 @@ is emitted if the C<use warnings> pragma or the B<-w> command-line flag
 
 =item C<RE> in C<?RE?>, C</RE/>, C<m/RE/>, C<s/RE/foo/>,
 
-Processing of C<\Q>, C<\U>, C<\u>, C<\L>, C<\l>, and interpolation
-happens (almost) as with C<qq//> constructs.
-
-However combinations of C<\> followed by RE-special chars are not
-substituted but only skipped. The full list of RE-special chars is
-C<\>, C<.>, C<^>, C<$>, C<@>, C<A>, C<G>, C<Z>, C<d>, C<D>, C<w>, C<W>,
-C<s>, C<S>, C<b>, C<B>, C<p>, C<P>, C<X>, C<C>, C<+>, C<*>, C<?>, C<|>,
-C<(>, C<)>, C<->, C<n>, C<r>, C<t>, C<f>, C<e>, C<a>, C<x>, C<c>, C<z>,
-digits (C<0> to C<9>), C<[>, C<{>, C<]>, C<}>, whitespaces (SPACE, TAB,
-LF, CR, FF, and VT in addition), and C<#>.
+Processing of C<\Q>, C<\U>, C<\u>, C<\L>, C<\l>, C<\E>,
+and interpolation happens (almost) as with C<qq//> constructs.
+
+However any other combinations of C<\> followed by a character
+are not substituted but only skipped, in order to parse them
+as regular expressions at the following step.
 As C<\c> is skipped at this step, C<@> of C<\c@> in RE is possibly
 treated as an array symbol (for example C<@foo>),
 even though the same text in C<qq//> gives interpolation of C<\c@>.
-Note that C<\N{name}> is interpolated at this step.
 
 Moreover, inside C<(?{BLOCK})>, C<(?# comment )>, and
 a C<#>-comment in a C<//x>-regular expression, no processing is