in reply to Re^2: Help with removing duplicates in array
in thread Help with removing duplicates in array
Are you perhaps confusing a string with a list?
use strict; use warnings; use feature 'say'; sub uniq { #and this to handle the duplicated emails return keys %{ { map { $_ => 1 } @_ } }; } my $string = 'aaaa@jjj.net aaaa@jjj.net aaaa@jjj.net aaaa@jjj.net aaaa +@jjj.net aaaa@jjj.net aaaa@jjj.net'; say "string: ", join ' ', uniq($string); say "list: ", join ' ', uniq(split(/ /, $string));
|
|---|