You could manually escape your inputs using quote
(as described in DBI
), but that's still a lot of interpolation and kind of a mess. Cleaner would be to use Placeholders and Bind Values
. For example, if I were writing your code, it might look more like
my $sql = <<EOSQL;
insert into Table ( Ticket_ID,
my $query = $dbh->prepare($sql) or die $dbh->errstr;
) or die $dbh->errstr;
Also note I corrected a typo in your SQL - in the future, make sure that what you post actually compiles/runs/demonstrates your issue, as described in How do I post a question effectively?
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.