updated patch:

Index: perlfaq4.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
retrieving revision 1.21
diff -u -d -r1.21 perlfaq4.pod
--- perlfaq4.pod        6 May 2002 13:08:46 -0000       1.21
+++ perlfaq4.pod        14 May 2002 16:20:41 -0000
@@ -1396,13 +1396,20 @@
        $_ *= (4/3) * 3.14159;  # this will be constant folded
     }
 
-If you want to do the same thing to modify the values of the hash,
-you may not use the C<values> function, oddly enough.  You need a slice:
+If you want to do the same thing to modify the values of the
+hash, you can use the C<values> function.  As of Perl 5.6
+the values are not copied, so if you modify $orbit (in this
+case), you modify the value.
 
-    for $orbit ( @orbits{keys %orbits} ) {
+    for $orbit ( values %orbits ) {
        ($orbit **= 3) *= (4/3) * 3.14159; 
     }
-
+    
+Prior to perl 5.6 C<values> returned copies of the values,
+so older perl code often contains constructions such as
+C<@orbits{keys %orbits}> instead of C<values %orbits> where
+the hash is to be modified.
+    
 =head2 How do I select a random element from an array?
 
 Use the rand() function (see L<perlfunc/rand>):

Reply via email to