my @keywords = ('this','that','other','foo','this', 'bar'); ^dupe #### my @keywords = ('this','that','other','foo','THIS', 'bar'); ^uc(dupe) #### use strict; my (@keywords, %keywords); @keywords = ('this', 'that', 'other', 'foo', 'THIS', 'bar'); @keywords{map lc,@keywords}=(); @keywords = sort keys %keywords; foreach my $word (@keywords) { print $word . "\n"; }