in reply to Re: Faster search and replace?
in thread Faster search and replace?

Oh -- right. Compile the regex once, right? That's a good idea. Further, you really point right to the problem -- I'm thinking about this "wrong" and just re-using code in a way that isn't efficient.

My snippet is great for little form letter types of things where I don't know too much about the problem beforehand, but in this case I know very precisely beforehand the characters that are "wrong" and for each one I know the "right" replacement -- so I should be using a

eval("tr/$wronglist/$rightlist/");
which has got to be better optimized for this kind of application.

Interesting: someone else has done this same thing and found (apparently) a memory leak. I guess I'm on the right track now.

Thanks for the new perspective! As always, TMTOWTDI, and some are better than others :)