in reply to How do I remove the duplicates from the array?

use List::MoreUtils qw{uniq}; my @array = uniq (-20, 20, 1, 1, 2, 2, 2, 9, 3, -4, -4, 5, -20, 20, 7 +, 7, 7); foreach (@array){print "$_, "};