use strict; use warnings; use List::MoreUtils qw/uniq/; my @array = qw/Returns a new list by stripping duplicate values in LIST The order of elements in the returned list is the same as in LIST In scalar context returns the number of unique elements in LIST/; my @drop_duplicates = uniq grep {length > 4} @array; { local $, = "\n"; print @drop_duplicates;} #### use strict; use warnings; my @array = qw/Returns a new list by stripping duplicate values in LIST The order of elements in the returned list is the same as in LIST In scalar context returns the number of unique elements in LIST/; my %seen; my @only_once = grep {$seen{$_} == 1 } map {$seen{$_}++; $_} grep {length > 4} @array; { local $, = "\n"; print @only_once;}