in reply to Help with removing duplicates in array
sub uniq { #and this to handle the duplicated emails return keys %{ { map { $_ => 1 } @_ } }; } say join ' ', uniq(qw( ABC DEF GHI JKL ABC DEF ABC ));
Output:
GHI DEF ABC JKL
What do you mean by no "good results"? Note that $#filtered doesn't represent the number of duplicates removed, as the variable name suggests, but the number of unique e-mails minus 1. To get the number of removed ones, just use
my $removed = @findemails - @filtered;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with removing duplicates in array
by beanscake (Acolyte) on Mar 27, 2015 at 12:36 UTC | |
by hippo (Archbishop) on Mar 27, 2015 at 13:44 UTC |