while () { print FINAL $_ if /(my first line)/; print FINAL "$_\n" if /(my second line)/; print FINAL $_ if /(my third line)/; }