in reply to Extract and re-write
Use strict;
Format your code in such a way that you can identify all "{" with all matching "}".
Open filehandles in the format open FH, '<', 'c:\pathoffile\file'; - it reads better.
Following the above rules would help you immensely in case your code goes wrong.
Rupesh.