[comp.lang.perl] Pattern matching problems

CFGROB@weizmann.bitnet (11/09/90)

I have a couple of pattern matching problems that I would like to get
the Perl communities professional help with. They both involve parsing
expressions.

  1. A pair of matching parenthesesis.
     E.g.
        $_="3+(4+a*(2+5)+3)+(5*9)"
     should after matching yield
        $`="3+"
        $&="(4+a*(2*5)+3)"
        $'="+(5*9)"
     At the moment I implemented it in a scanning C like procedure, but
     I feel it is not in the true spirit of Perl. Any suggestions?

  2. Protect matching parethesises so that matching do NOT occur within
     them.
     E.g.
       $_="function a(var b: integer); var c: integer;"
     should match
       $`="function a(var b: integer); "
       $&="var"
       $'=" c: integer;"
     The solution of 1. would allow me to carry out the replacement by
     repeatedly replacing the "var" of $` part as I carry out the
     match parenthesis on the old $' string.

     Does anyone have any other ideas?

Again I repeat my question if there is a VMS version of Perl available
anywhere or if someone is prepared to take on the porting?

Dov