The idiomatic way of eliminating duplicates creates an hash of counts as a byproduct.
my %counts; my @uniqueIPs = grep !$counts{$_}++, @ipAddresses; for my $ip (sort @uniqueIPs) { print("$ip ($counts{$ip})\n"); }
In reply to Re: Counting unique instances from Array Sort
by ikegami
in thread Counting unique instances from Array Sort
by ewhitt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |