in reply to escaping special charcters from a string

According to this the php addslashes function does the following:

string addslashes(string str)
Escapes single quote, double quotes and backslash characters in a string with backslashes

which you can do with:

$string =~s/(['"\\])/\\$1/g;

--------------------------------------------------------------

"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."

John Brunner, "The Shockwave Rider".