gfausel has asked for the wisdom of the Perl Monks concerning the following question:
Logically I would think that this should work. Take the words "WE LOVE", the first pass thru should take all the lines that contain the word "WE" and place them into DataTmp, which is then assigned back to DataIn. The second pass should then take all the lines that contain "LOVE" and place that in DataTmp, etc. However, the final output only shows those lines that have "WE LOVE" in them in that order, which is exactly what it did before my changes. is there something simple I am overlooking, or?? Thank you, Glennif($lT && $Title ne "*") { for($index=0;$index<@tit;$index++) { $wrd=$tit[$index]; print "$index,$wrd\n"; COMMENT - to make sure each word was processed +individually. Works. `grep -i \"$wrd\" $DataIn > $DataTmp`; COMMENT - I am assuming that th +e GREP results from DataIn are copied into DataTmp $DataIn=$DataTmp; COMMENT - here the files are swapped I guess. if($DataTmp eq $DataTmpa){$DataTmp=$DataTmpb;print "tempb\n";} # if else{$DataTmp=$DataTmpa;print "tempa\n";} # else } # for } # if $IT
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Online GREP problem
by almut (Canon) on Apr 05, 2010 at 20:42 UTC | |
by gfausel (Initiate) on Apr 05, 2010 at 21:13 UTC | |
by almut (Canon) on Apr 05, 2010 at 21:26 UTC | |
|
Re: Online GREP problem
by choroba (Cardinal) on Apr 05, 2010 at 20:48 UTC | |
by gfausel (Initiate) on Apr 05, 2010 at 21:07 UTC | |
|
Re: Online GREP problem
by Anonymous Monk on Apr 05, 2010 at 20:29 UTC | |
|
Re: Online GREP problem
by gfausel (Initiate) on Apr 06, 2010 at 01:44 UTC |