summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-03-07 21:39:29 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-03-07 21:39:29 +0000
commitf127762ae8ed5af83de18a858019907e3c7f32ea (patch)
tree1874457638eaca8c61c53a759ef3ebfddc63031a /pod
parent4fd193acd0d951124e02044838daf1b0316a9058 (diff)
parent4bad07d97843302fe0c8fcda3be736e92b097422 (diff)
downloadperl-f127762ae8ed5af83de18a858019907e3c7f32ea.tar.gz
Integrate mainline.
p4raw-id: //depot/perlio@9074
Diffstat (limited to 'pod')
-rw-r--r--pod/perlop.pod5
-rw-r--r--pod/perlretut.pod37
-rw-r--r--pod/perlsyn.pod8
3 files changed, 28 insertions, 22 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 8f2ecde031..9e6634a5c3 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -242,14 +242,15 @@ operators, like C<-f>, C<-M>, etc. See L<perlfunc>.
If any list operator (print(), etc.) or any unary operator (chdir(), etc.)
is followed by a left parenthesis as the next token, the operator and
arguments within parentheses are taken to be of highest precedence,
-just like a normal function call. Examples:
+just like a normal function call. For example,
+because named unary operators are higher precedence than ||:
chdir $foo || die; # (chdir $foo) || die
chdir($foo) || die; # (chdir $foo) || die
chdir ($foo) || die; # (chdir $foo) || die
chdir +($foo) || die; # (chdir $foo) || die
-but, because * is higher precedence than ||:
+but, because * is higher precedence than named operators:
chdir $foo * 20; # chdir ($foo * 20)
chdir($foo) * 20; # (chdir $foo) * 20
diff --git a/pod/perlretut.pod b/pod/perlretut.pod
index a77b87e125..fa6479c0c4 100644
--- a/pod/perlretut.pod
+++ b/pod/perlretut.pod
@@ -1720,29 +1720,32 @@ characters,
$x =~ /^\p{IsLower}/; # doesn't match, lowercase char class
$x =~ /^\P{IsLower}/; # matches, char class sans lowercase
-If a C<name> is just one letter, the braces can be dropped. For
-instance, C<\pM> is the character class of Unicode 'marks'. Here is
-the association between some Perl named classes and the traditional
-Unicode classes:
+Here is the association between some Perl named classes and the
+traditional Unicode classes:
- Perl class name Unicode class name
+ Perl class name Unicode class name or regular expression
- IsAlpha Lu, Ll, or Lo
- IsAlnum Lu, Ll, Lo, or Nd
- IsASCII $code le 127
- IsCntrl C
+ IsAlpha /^[LM]/
+ IsAlnum /^[LMN]/
+ IsASCII $code <= 127
+ IsCntrl /^C/
+ IsBlank $code =~ /^(0020|0009)$/ || /^Z[^lp]/
IsDigit Nd
- IsGraph [^C] and $code ne "0020"
+ IsGraph /^([LMNPS]|Co)/
IsLower Ll
- IsPrint [^C]
- IsPunct P
- IsSpace Z, or ($code lt "0020" and chr(hex $code) is a \s)
- IsUpper Lu
- IsWord Lu, Ll, Lo, Nd or $code eq "005F"
+ IsPrint /^([LMNPS]|Co|Zs)/
+ IsPunct /^P/
+ IsSpace /^Z/ || ($code =~ /^(0009|000A|000B|000C|000D)$/
+ IsSpacePerl /^Z/ || ($code =~ /^(0009|000A|000C|000D)$/
+ IsUpper /^L[ut]/
+ IsWord /^[LMN]/ || $code eq "005F"
IsXDigit $code =~ /^00(3[0-9]|[46][1-6])$/
-For a full list of Perl class names, consult the mktables.PL program
-in the lib/perl5/5.6.0/unicode directory.
+You can also use the official Unicode class names with the C<\p> and
+C<\P>, like C<\p{L}> for Unicode 'letters', or C<\p{Lu}> for uppercase
+letters, or C<\P{Nd}> for non-digits. If a C<name> is just one
+letter, the braces can be dropped. For instance, C<\pM> is the
+character class of Unicode 'marks'.
C<\X> is an abbreviation for a character class sequence that includes
the Unicode 'combining character sequences'. A 'combining character
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index e6b420e5db..aad4efd2f7 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -263,7 +263,7 @@ available. Replace any occurrence of C<if BLOCK> by C<if (do BLOCK)>.
=head2 For Loops
-Perl's C-style C<for> loop works exactly like the corresponding C<while> loop;
+Perl's C-style C<for> loop works like the corresponding C<while> loop;
that means that this:
for ($i = 1; $i < 10; $i++) {
@@ -279,8 +279,10 @@ is the same as this:
$i++;
}
-(There is one minor difference: The first form implies a lexical scope
-for variables declared with C<my> in the initialization expression.)
+There is one minor difference: if variables are declared with C<my>
+in the initialization section of the C<for>, the lexical scope of
+those variables is exactly the C<for> loop (the body of the loop
+and the control sections).
Besides the normal array index looping, C<for> can lend itself
to many other interesting applications. Here's one that avoids the