in reply to How to creat a flat file from config. file?
This really looks like a good use for the Parse::RecDescent module. You can get it from CPAN.