Two Perl -> Ruby Questions

Matz:
eval BLOCK is used for exception handling, so that “begin … rescue … end” should be the answer.

Austin:

Ah. That makes a little sense; I think I can deal with that.

Matz:
There’s no identical feature. Show me the original Perl code.

Austin:

Text::Balance – from the Parse::RecDescent code. Yes, I’m trying to convert Damian’s code to Ruby. I need it to help with the Spreadsheet::Excel work to add formulas. Except not really being familiar with \G zero-width regex; I suspect that most of what he’s using it for can be simulated with judicious use of Array#scan.

-austin

“Austin Ziegler” austin@halostatue.ca writes:

There’s no identical feature. Show me the original Perl code.

Austin:

Text::Balance – from the Parse::RecDescent code. Yes, I’m trying to
convert Damian’s code to Ruby. I need it to help with the
Spreadsheet::Excel work to add formulas. Except not really being
familiar with \G zero-width regex; I suspect that most of what he’s
using it for can be simulated with judicious use of Array#scan.

I’ve run into places where I could have used pos() and \G to achieve
efficiency, for the same reason that the strscan ruby extension
exists.