Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: sorting an array of hashes and removing duplicates

by Enlil (Parson)
on Apr 02, 2010 at 00:04 UTC ( #832404=note: print w/replies, xml ) Need Help??


in reply to sorting an array of hashes and removing duplicates

Another way to do it might be to just run the output of the sort through another filter like so:
my %seen; my @sortthetutors = grep { !$seen{$_->{tutorsID}}++ } sort { $a->{tmiles} <=> $b->{tmiles} } @tutorsdata;
-enlil

Replies are listed 'Best First'.
Re^2: sorting an array of hashes and removing duplicates
by jmfees (Initiate) on Apr 02, 2010 at 08:51 UTC

    This one worked beautifully, I tested it on 80,000 records, it took just a couple seconds...

    Thanks!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832404]
help
Chatterbox?
[Lady_Aleena]: Corion, I knew that, I was just giving Discipulus a hard time.
choroba likes the story at the end of the node
[choroba]: reminds me of the days at the bank
[Corion]: Lady_Aleena: Hehe ;-D
[Lady_Aleena]: Corion, it was PerlMonks who kept pushing me to get Linux, so now I know some of the commands to use in word play.
[Corion]: Lady_Aleena: :-D

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-04-26 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (471 votes). Check out past polls.