http://www.perlmonks.org?node_id=832404


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!!!