I need to see if there are duplicates in an array of strings, what\'s the most time-efficient way of doing it?
Not a direct answer, but this will return an array without duplicates:
#!/usr/bin/perl use strict; use warnings; my @arr = ('a','a','a','b','b','c'); my %count; my @arr_no_dups = grep { !$count{$_}++ } @arr; print @arr_no_dups, "\n";