![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re^2: how to comment the lines if found a matchby kavitha (Initiate) |
on Dec 05, 2008 at 21:49 UTC ( #728395=note: print w/replies, xml ) | Need Help?? |
This is how my program looks like now. I tried this but the grep here is not returning right value, its returning 1 as if its matching all the time. #!/usr/bin/perl -w open(MATCH_PATTERN,"< temp1"); open(FILE_TO_LOOK,"< temp2"); open OF, "> temp3"; while ($m =<MATCH_PATTERN>) { print "reading the current text to match \n $m \n"; seek (FILE_TO_LOOK ,0, 0); while ($l= <FILE_TO_LOOK>) { print "reading the textline to look for match \n $l \n"; @found = grep ($m, $l) ; $match = @found; if ($match == 1) { print "now the match is \n $match \n"; print OF "#$l"; } } } close FILE_TO_LOOK; close MATCH_PATTERN; close OF;
In Section
Seekers of Perl Wisdom
|
|