Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: In-place sort with order assignment

by creamygoodness (Curate)
on Sep 20, 2010 at 14:58 UTC ( #860854=note: print w/replies, xml ) Need Help??


in reply to In-place sort with order assignment

You can use Sort::External for stuff like this.
use Sort::External; my $sortex = Sort::External->new; while ( my ($k, $v) = each %hash) ) { # aliases, so no memory hit $sortex->feed($k); } $sortex->finish; my $counter = 1; while (defined($_ = $sortex->fetch)) { $hash{$_} = $counter++; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://860854]
help
Chatterbox?
[marto]: someone else writes: [http://www. evanmiller.org/why -im-learning-perl- 6.html|
[marto]: err, Why Iím Learning Perl 6

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2017-07-26 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (395 votes). Check out past polls.