In comp.lang.perl.misc I recently offered this solution.
s/(\\[^"\$\@]+)/qq("$1")/eeg;
Note that's not 100% infalible but AFAIK it's not a security problem and copes with all reasonable strings. It does have the interesting side effect of stripping \$ \" and \@ - but those have no buisness being in most of the sort of strings you'll encounter.
In reply to Re^2: efficient char escape sequence substitution
by nobull
in thread efficient char escape sequence substitution
by mifflin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |