in reply to Pattern String Matching while parsing a file
As a side note, please note that it is probably unnecessary to chomp your input line if you're just going to add "\n" to it immediately after.