foreach $sourceLine (@SourceData) { chomp $sourceLine; chomp $functionName; if ($functionName =~ /$sourceLine/) {$counter++;} }