in reply to Text comparisons

I think your first example is backwards. Try
foreach my $sourceLine ( @SourceData ) { if ( $sourceLine =~ /\b$functionName\b/ ) { $counter++; } }
Note that \b matches a "word boundary", which prevents matching on non-function names embedded in other "words" (including other function names). But it doesn't handle the problem where function names are mentioned in comments.

-QM
--
Quantum Mechanics: The dreams stuff is made of