DB<1> use List::MoreUtils "uniq"; print uniq qw(a a a a b c c a a d e e e e) abcde