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