in reply to Online GREP problem
I would say the problem lies in the "switching" of files. On the next iteration of the loop, result of the previous grep is used as input. Therefore, in your example, the word "LOVE" is being searched only on lines already containing "WE".
You should grep always the original input file. But it would be faster to search for all the words at the same time, i.e. changing "WE LOVE" to "WE\|LOVE" (by something like $wrd =~ s/ /\\|/g) and greping just for this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Online GREP problem
by gfausel (Initiate) on Apr 05, 2010 at 21:07 UTC |