in reply to removing duplicates from an array of hashes

Hi,

Here is another way of removing duplicate elements from array of hash.

use strict; use warnings; use Data::Dumper; my $ref = []; $ref->[0] = { id => 'a' }; $ref->[1] = { id => 'b' }; $ref->[2] = { id => 'c' }; $ref->[3] = { id => 'b' }; #But using temp hash my $temp_hash={}; my @Uniqe_Array_Of_Hash = grep { $_ && ++$temp_hash->{$_->{id}}< 2 } + @$ref; print Dumper \@Uniqe_Array_Of_Hash;

All is well