in reply to Delete lines

Because you're simply reading in lines and then printing them out again, I suggest that rather than change what's in $_ you use your conditional construct (if {...} else {...}) to decide what actions to actually take with each line. Then it's a simple matter to discard another line:

if (/\{T\}/) { my $throwaway_line=<DATA>; # that line will never get printed now } else { print ; # print with no arguments prints $_ }

Basically if you just read another line from the file, and don't print it, you'll get what you want, I think. (I'm having a little trouble reading your post, so my code may not quite solve the problem you're describing, but hopefully it's close enough that you can adapt it.)

I also highly recommend using strict and warnings as standard practice.