my @arr = (4, 1, 6, 4, 3, 7); my %saw = map{ $_ => undef } @arr; my @new_arr = keys %saw; print sort @new_arr;