summaryrefslogtreecommitdiff
path: root/pod/perlop.pod
diff options
context:
space:
mode:
authorMike Guy <mjtg@cam.ac.uk>2002-02-26 18:30:22 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-02-28 00:50:01 +0000
commit54ae734e012df09694a97dd182931816c572ff76 (patch)
treed1e70798c7f59802b86c2586aa066036a2c0b260 /pod/perlop.pod
parent378bd967209b924b23dccb1e4ea9a910d7a0b72e (diff)
downloadperl-54ae734e012df09694a97dd182931816c572ff76.tar.gz
The "list" part of
Subject: [PATCH perlop] .. returns a *list* of *integers* Message-Id: <E16fmMo-00048Y-00@draco.cus.cam.ac.uk> plus few nits. p4raw-id: //depot/perl@14906
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r--pod/perlop.pod9
1 files changed, 6 insertions, 3 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 73564ef1ed..944772b758 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -395,10 +395,10 @@ Using "or" for assignment is unlikely to do what you want; see below.
Binary ".." is the range operator, which is really two different
operators depending on the context. In list context, it returns an
-array of values counting (up by ones) from the left value to the right
+list of values counting (up by ones) from the left value to the right
value. If the left value is greater than the right value then it
returns the empty array. The range operator is useful for writing
-C<foreach (1..10)> loops and for doing slice operations on arrays. In
+C<foreach (1..10)> loops and for doing slice operations on arrays. In
the current implementation, no temporary array is created when the
range operator is used as the expression in C<foreach> loops, but older
versions of Perl might burn a lot of memory when you write something
@@ -408,6 +408,9 @@ like this:
# code
}
+The range operator also works on strings, using the magical auto-increment,
+see below.
+
In scalar context, ".." returns a boolean value. The operator is
bistable, like a flip-flop, and emulates the line-range (comma) operator
of B<sed>, B<awk>, and various editors. Each ".." operator maintains its
@@ -462,7 +465,7 @@ can say
@alphabet = ('A' .. 'Z');
-to get all normal letters of the alphabet, or
+to get all normal letters of the English alphabet, or
$hexdigit = (0 .. 9, 'a' .. 'f')[$num & 15];