princepawn has asked for the wisdom of the Perl Monks concerning the following question:
However, I dont know how to use this code. The second binding $_ should return a 0 and the first should return a 1. the print is an addition by me and I see it's fault: it is saying while this works print a 1, but I dont know a way to say when this doesnt work print something other than a 1 so I know that the string has imbalanced parens somewhere$_='a(b(c)d(e(f)g)h)i(j(k)l(m)n)o'; $_='a(b(c)d(e(f(g)h)i(j(k)l(m)n)o)'; print 1 while s/[(][^()][)]//;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getting a return code from a looping regular expression
by BlaisePascal (Monk) on Aug 01, 2000 at 17:40 UTC | |
by DrManhattan (Chaplain) on Aug 01, 2000 at 19:32 UTC | |
by BlaisePascal (Monk) on Aug 01, 2000 at 22:57 UTC | |
by maverick (Curate) on Aug 01, 2000 at 19:30 UTC | |
|
Re: getting a return code from a looping regular expression
by splinky (Hermit) on Aug 01, 2000 at 23:43 UTC |