in reply to Substitution Question

I'm wary of your question. How are you going to be using this new string? If it's to launch a child process, you should consider the shell-less multi-arg version of system or exec. If it's for a DBI query, consider using placeholders.

Simply backwhacking your quotes is often not necessary, nor is it ever sufficient.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.