quote_identifier()
$dbh->quote_identifier({$name|$catalog, $database[, $table, \%attri]})
Use this function to escape special characters of an
identifier (e.g., a database, table, or column name) for use in an SQL
statement. You can provide only the first parameter (a string
containing an identifier name), or you can provide the catalog name
(undef is acceptable with MySQL), a database name,
a table name, and optionally provide database attributes. Here is an
example:
my $col1 = $dbh->quote_identifier('author');
my $col2 = $dbh->quote_identifier('title');
my $table = $dbh->quote_identifier('books');
my $sql_stmnt = "SELECT $col1, $col2 FROM $table";
print $sql_stmnt;Here is the resulting SQL statement:
SELECT `author`, `title` FROM `books`