On 16 Mar 2008, at 03:35, Allan Odgaard wrote:
[...] So probably this regexp subst. is more appropriate:
s/(?=[$`\])/\/
Actually, that was crafted as a global subst. and not iteratively run on the line, as your code did.
Probably would be best to just count matches (for your $add_to_index) and then run this subst. with /g (and it seems for perl, you need to escape $ even when inside a character class).