foreach my $unique (@second_list_new) { if ($unique ~~ @first_list_new)) { print "already there $unique\n\n"; } else { print "newly in this $unique\n\n"; } } #### if (grep (/^\Q$unique\E$/,@first_list_new)) #### my @first_list_new = map { s/\s*$//m; lc $_ } ;