title: How can I insert strings with quotes into Perl DBI queries?
body: <p>What is the preferred way to insert strings that can contain both single and double quotes (",') into MySql using DBI?  For example, <code>$val1</code> and <code>$val2</code> can contain quotes:</p>
  
  <pre><code>my $dbh = DBI-&gt;connect( ... );
  my $sql = "insert into tbl_name(col_one,col_two) values($val1, $val2)";
  my $sth = $dbh-&gt;prepare($sql);
  $sth-&gt;execute();
  </code></pre>