in reply to Re: Matching paired characters.
in thread Matching paired characters.

Many thanks for responding.

Perhaps I didn't set up the problem in a coherent manner.
I am working on a program which involves compiling and executing auto-generated code
At times, this auto-generated code is random code. This is all okay, but when the code is likely to
branch, many instances of random-code raise exceptions, simply by virtue of a missing or extra curly bracket.

Now here's the problem: before I eval the code, how do I check it, and if necessary, correct it?

The eval code is constructed from a list of Perl statements, which may or may not contain a { or a }.
Before the eval, the code needs to be checked and corrected.

I've had a look at the Regexp::Common, though I am fairly sure that it can't correct the unbalanced parentheses in
a list of statements. Am I a spanner - am I making a square wheel - or do I need to keep with this one?

Many thanks,
gullcatcher