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
    Thanks for the reply. Problem is that there are 5 diff greps, and each does the same thing, switching the files, so each iterance of the file is already "slimmed" down. This is for phonograph records, so there may have been an artist or label already GREPed. This has always worked fine, only my alteration does not. And the reason I use an array is there could be one word, 2,3,4 etc.