in reply to Re: parsing question

I'm not sure I'd want to approach this with just a regex matching loop.

This seems like it could quickly get out of hand, depending upon how nested the constructs in your "text" files can get. Perhaps you might take a look at using Parse::RecDecent to turn the input file into a parse tree and then re-encode THAT with slightly different rules (i.e., don't use curly braces around a block where there is only a single enclosed statement).

dmm