Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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


Comment on Re: sorting an array of hashes and removing duplicates
Download Code
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-01-25 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (181 votes), past polls