in reply to
Error using grep
You chop the keyword, but you do not chop the lines.
chomp
might be better for both.
Comment on
Re: Error using grep
In Section
Seekers of Perl Wisdom