in reply to Re: Sorting IP addresses, lots of them, quickly
in thread Sorting IP addresses, lots of them, quickly

If only perl had an in-place sort option...

Actually it has, @in = sort @in; is optimized as an in-place sort!

Replies are listed 'Best First'.
Re^3: Sorting IP addresses, lots of them, quickly
by jdporter (Paladin) on May 16, 2007 at 18:58 UTC

    Do you have any documentation for that? The sort manpage doesn't mention any such thing.

    A word spoken in Mind will reach its own level, in the objective world, by its own weight
      AFAIK, it is not officially documented in any place, but you can see it's true dumping the OP tree:
      salva@vespa:/tmp$ perl -MO=Concise -e '@i = sort @j' c <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 b <2> aassign[t5] vKS ->c - <1> ex-list lK ->8 3 <0> pushmark s ->4 7 <@> sort lK ->8 4 <0> pushmark s ->5 6 <1> rv2av[t4] lK/1 ->7 5 <#> gv[*j] s ->6 - <1> ex-list lK ->b 8 <0> pushmark s ->9 a <1> rv2av[t2] lKRM*/1 ->b 9 <#> gv[*i] s ->a -e syntax OK salva@vespa:/tmp$ perl -MO=Concise -e '@i = sort @i' 8 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 - <1> ex-aassign vKS/64 ->8 - <1> ex-list lK ->- 3 <0> pushmark s ->4 7 <@> sort lK/INPLACE ->8 4 <0> pushmark s ->5 6 <1> rv2av[t4] lKRM*/1 ->7 5 <#> gv[*i] s ->6 - <1> ex-list lK ->- - <0> ex-pushmark s ->- - <1> ex-rv2av lKRM*/1 ->- - <0> ex-gv s ->- -e syntax OK