in reply to grep in line and print
That code certainly doesn't do what you think it does. Add a print $line,"\n"; statement just after foreach to see why.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom