Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Sorting Array in Place

by pg (Canon)
on Nov 25, 2002 at 00:02 UTC ( #215555=note: print w/replies, xml ) Need Help??


in reply to Sorting Array in Place

Agree, it will be nice if sort behaves in such a way:
  1. if the parm being passed in is a list, behave in the traditional way;
  2. if the parm being passed in is a ref to an array, do an in-place sort as you suggested.

Replies are listed 'Best First'.
Re: Re: Sorting Array in Place
by dbp (Pilgrim) on Nov 26, 2002 at 00:22 UTC
    Well, I'm toying with the idea of a module that provides a sort_inplace function which acts a lot like sort but takes array references as a sort of stop-gap solution. Is there any way to get $a and $b to represent the first two values of @_ as in sort? See my scratchpad for some code and a more detailed description.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://215555]
help
Chatterbox?
[marioroy]: choroba++, Discipulus++. It depends on the type of module. Data-type "only" modules are likely multi-process safe, re: Hash::Ordered, Tie::IxHash.
[marioroy]: ... when shared via MCE::Share-> share(...)
[marioroy]: Net type modules are likely not multi-process safe unless stated in the documentation.
[marioroy]: The Prima author fixed his module to be both thread and multi-process safe. Thanks Dmitry.
[marioroy]: Of all the GUI-type modules, Prima was the worst regarding thread/multi- process safety. Now, it's the best for safety. ;-)
[marioroy]: Tk, Gtk2, Gtk3 requires extra care.
[marioroy]: I was unable to run parallel with Win32::Console. Fortunately, running parallel behind Win32::API is possible.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-09-22 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (260 votes). Check out past polls.

    Notices?