my %saw; # note the hash @emails = grep(!$saw{$_}++, @emails); # note the curlies