in reply to Re: Eliminate exact duplicates from array of hashes
in thread Eliminate exact duplicates from array of hashes
use strict; use warnings; use Data::Dumper; my @test_data = ( { a=>1, b=>2 }, { ab => 12} ); my %unique = map { my @k=sort(keys %$_); join("",@k, @$_{@k}) => $_ } @test_data; print Dumper [values %unique];
$VAR1 = [ { 'ab' => 12 } ];
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Eliminate exact duplicates from array of hashes
by NetWallah (Canon) on Oct 09, 2019 at 21:36 UTC |