http://www.perlmonks.org?node_id=1127335


in reply to how to insert new line in text file after regex match?

This is simple - in your loop reading the lines, you remember when you see a line containing first. Then you count and output two more lines, and then output the additional line.

If you want to help us help you better, please show us the code you have already written and explain how it fails to do what you want it to do.