A Non-Kludgey way to Escape MySQL quotes in Perl?
Posted by: jerrykrinock
Posted on: 2006-07-11 09:47:00
I find that, even if the value is not a keyword, MySQL always wants it to be in single quotes. But single quotes are swallowed by perl to convert my variable names into literal values. So, I write stuff like this:
my $query = q{
SELECT licenseNumber, licenseeName
FROM sales
WHERE serialNumber = '} ;
$query .= $serialNumberReceived ;
$query .= q{'} ;
Is there not a more elegant way to do this??