Let's take a step back and look at what you're trying to achieve. From the presence of "MySQL" in your example string, I'm wondering if you aren't trying to "quote" a string so that you can use it to construct an INSERT query for MySQL. If that's the case, you're better off leaving the undoubled quote in the string, using a query parameter in your SQL, and passing the unquoted string to
execute(), which will correctly quote its arguments.
For example:
my $sth = $dbh->prepare("INSERT INTO foo VALUES(?)");
$sth->execute($stringThatMightOrMightNotContainQuotes);