Originariamente inviato da Claudio Vituzzi
Io farei più o meno così:

codice:
#!/usr/bin/perl

use strict;
use warnings;
use DBI;

my ($dbh, $sql, $sth);

# $id = id del record
# $nome = nuovo valore

$dbh = DBI->connect();
	

$sql = qq~UPDATE agenda SET nome=? WHERE id=?~;
$sth=$dbh->prepare( $sql );
$sth->execute($nome,$id); # Fa automaticamente l'escape	 di caratteri speciali 

$sql = qq~OPTIMIZE TABLE agenda~;
$sth=$dbh->prepare( $sql );
$sth->execute;
	

$dbh->disconnect;
Così non fai l'escape