my @a1 = qw(one two three); my @a2 = qw(one five four); my %h = map { $_ => 1 } (@a1, @a2); my @r = keys(%h); print "@r\n";