![]() |
|
"be consistent" | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
You are misunderstanding the use of grep. In your example, grep will always return $l unless $m happens to be 0 or an empty string. Instead of grep, you probably want a regular expression.
You probably also want to use chomp in the outer loop to remove the line ending from $m. You are also writing the file multiple times with different lines commented each time. You might want to generate a list of the expressions to match at the beginning and then loop over the file once.
G. Wade
In reply to Re^3: how to comment the lines if found a match
by gwadej
|
|