ScarryJerry has asked for the wisdom of the Perl Monks concerning the following question:
I am new to Perl.
I have looked at the FAQ's, online any other source I can find. I suspect this is a simple solution, but I am stuck.
I have a list of strings (function names) that I am tring to get a count of in source files. I have the function names in a list and I read the source file into antoher list. I have tried various ways of comparing them , for example
orforeach $sourceLine (@SourceData) { if ($functionName =~ /$sourceLine/) {$counter++;} }
$counter = grep (/$functionName/ , @SourceData);
Either way I always get a value of 0 for the counter.
Any suggestions as to what I am doing wrong ?
TIA !
Jerry
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text comparisons
by QM (Parson) on Mar 24, 2004 at 19:23 UTC | |
|
Re: Text comparisons
by CountZero (Bishop) on Mar 24, 2004 at 19:45 UTC | |
|
Re: Text comparisons
by Vautrin (Hermit) on Mar 24, 2004 at 19:21 UTC | |
|
Re: Text comparisons
by McMahon (Chaplain) on Mar 24, 2004 at 19:31 UTC | |
|
Re: Text comparisons
by ScarryJerry (Initiate) on Mar 25, 2004 at 14:10 UTC |