From: John P. Linderman Date: Fri, 5 Apr 2002 06:19:07 +0000 (-0500) Subject: Re: lib/sort.t failure X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=268e9d79709e84ed1633bc3a726a3322a3e51bae;p=p5sagit%2Fp5-mst-13.2.git Re: lib/sort.t failure From: "John P. Linderman" Message-ID: <200204051119.GAA00032@raptor.research.att.com> with a minor formatting tweak p4raw-id: //depot/perl@15742 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 322591a..d20851f 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4610,12 +4610,14 @@ Examples: use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; - # force use of quicksort (not portable outside Perl 5.8) - use sort '_quicksort'; # note discouraging _ + # force use of mergesort (not portable outside Perl 5.8) + use sort '_mergesort'; # note discouraging _ @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; - # similar to the previous example, but demand stability as well - use sort qw( _mergesort stable ); + # Similar to the previous example, but demand stability as well + # Because of the way quicksort is "stabilized", this combination + # is not threadsafe + use sort qw( _quicksort stable ); @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; If you're using strict, you I declare $a