summaryrefslogtreecommitdiff
path: root/pod/perlfaq6.pod
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2003-09-09 12:31:58 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-09-10 19:36:30 +0000
commit788611b6a6a160290f10302fc348e5dff91edc6e (patch)
tree5f33e98471e91b46634547597546c96c06a669ef /pod/perlfaq6.pod
parent084b8eeb79bb97cd6a1b051bc9b7db2007cf036f (diff)
downloadperl-788611b6a6a160290f10302fc348e5dff91edc6e.tar.gz
Remove the warning in perlfaq about using map in void context :
Subject: [PATCH perlfaq6] map in a void context. Message-ID: <20030909083158.GA24125@abigail.nl> p4raw-id: //depot/perl@21166
Diffstat (limited to 'pod/perlfaq6.pod')
-rw-r--r--pod/perlfaq6.pod15
1 files changed, 9 insertions, 6 deletions
diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod
index 0a134c3740..168233bd1b 100644
--- a/pod/perlfaq6.pod
+++ b/pod/perlfaq6.pod
@@ -679,15 +679,18 @@ guaranteed is slowness.) See the book "Mastering Regular Expressions"
hope to know on these matters (a full citation appears in
L<perlfaq2>).
-=head2 What's wrong with using grep or map in a void context?
+=head2 What's wrong with using grep in a void context?
-The problem is that both grep and map build a return list,
-regardless of the context. This means you're making Perl go
-to the trouble of building a list that you then just throw away.
-If the list is large, you waste both time and space. If your
-intent is to iterate over the list then use a for loop for this
+The problem is that grep builds a return list, regardless of the context.
+This means you're making Perl go to the trouble of building a list that
+you then just throw away. If the list is large, you waste both time and space.
+If your intent is to iterate over the list, then use a for loop for this
purpose.
+In perls older than 5.8.1, map suffers from this problem as well.
+But since 5.8.1, this has been fixed, and map is context aware - in void
+context, no lists are constructed.
+
=head2 How can I match strings with multibyte characters?
Starting from Perl 5.6 Perl has had some level of multibyte character