Dave Mitchell replied to david nicol as follows: > > There's some reverse-handling code in pp_sort which I took > > to be responding to a hint that > > > > reverse sort ... > > > > has been encountered: > > > > > > if (PL_op->op_private & OPpSORT_REVERSE) { > > SV **p = sorting_av ? AvARRAY(av) : ORIGMARK+1; > > SV **q = p+max-1; > > while (p < q) { > > SV *tmp = *p; > > *p++ = *q; > > *q-- = tmp; > > } > > } > > > No, that's for optimising away the sort block in > > @x = sort {$b cmp $a } @y; I was afraid somebody might say that. This breaks the promise of stability. The order of equal elements is now reversed from the input order. (I'm about to disappear on vacation, so don't interpret my silence as lack of interest). -- jplThread Previous | Thread Next