use String::Approx qw(amatch); my @list = qw(Apple Pear Orange); my @inputs = qw(aple appe peay range oranges mango appple aqqple); for my $word (@inputs) { if (amatch($word, ["i"], @list)) { print "Matched: $word to ??
"; } else { print "Unmatched: $word
"; } } #### Sample output: Matched: aple to ?? Matched: appe to ?? Matched: peay to ?? Desired output: Matched: aple to Apple Matched: appe to Apple Matched: peay to Pear