in reply to Re^3: Refactoring challenge.
in thread Refactoring challenge.

I would never have thought that @- and @+ where dependant upon /g? Is that a bug?
You need the /g because you are doing iterative matching in a while loop.

Caution: Contents may have been coded under pressure.