in reply to find text in string

I suggest using grep to search strings in array, or to find number of elements matching a criteria. The points are demonstrated in the code below:
use strict; use warnings; use Data::Dumper; my @GrepList = ("yesterday", "today", "tomorrow") ; # look for all elements with "to" in the string my @ElementList = grep(/to/i, @GrepList) ; print Dumper(@ElementList); ## In list context, returns the count of number of elements ## that meet the search criteria my $ElementsFound = grep(/to/i, @GrepList) ; print $ElementsFound;
Hope this helps
May the force be with you