This is PerlMonks "Mobile"

Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  


in reply to RFC: Simple switches for 'sort' and list 'reverse'

> I'm not sure how, but sorting by $a + $b reverses a list.

Interestingly, it doesn't work under

use sort '_quicksort';

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: RFC: Simple switches for 'sort' and numeric list 'reverse'
by rsFalse (Chaplain) on Mar 07, 2021 at 13:10 UTC
    Good observation!

    But also note that pragma '_quicksort' is undocumented e.g. in Perl 5.32 (5.32.0/sort). The information about default sorting algorithm seems to be absent in documentation*, sadly :(

    Upd. * It is absent in 5.32.0/sort and 5.32.0/functions/sort also, but it is documented in perlsec. I asked about it in an issue and later found that missing info sentence is going to be added into proper place IMO.