So it sounds like the resolution for this bug is to document that sort
uses aliases like grep does.  I've stolen the wording from grep.

-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
Reality is that which, when you stop believing in it, doesn't go away.
        -- Phillip K. Dick
--- pod/perlfunc.pod    2005/07/24 02:57:16     1.2
+++ pod/perlfunc.pod    2005/07/24 02:58:42
@@ -4926,6 +4926,12 @@
 When C<use locale> is in effect, C<sort LIST> sorts LIST according to the
 current collation locale.  See L<perllocale>.
 
+sort returns aliases into the original list, much as a for loop's
+index variable aliases the list elements.  That is, modifying an
+element of a list returned by sort (for example, in a "foreach", "map"
+or "grep") actually modifies the element in the original list.  This
+is usually something to be avoided when writing clear code.
+
 Perl 5.6 and earlier used a quicksort algorithm to implement sort.
 That algorithm was not stable, and I<could> go quadratic.  (A I<stable> sort
 preserves the input order of elements that compare equal.  Although

Reply via email to