in reply to Insert function

Perl does not support directly inserted SQL statement, as some lauguages do, like Pro*c etc. There might be new concepts to you when you learn DBI. Looking at your SQL statement, I think there is at least one thing you want to pay special attention to: prepared statement and placehold. Eventually, your code should look similar to this:

use DBI; my $dbh= DBI->connect("dbi:mysql:test", "", "", {RaiseError => 1, Auto +Commit => 0}); my $addprod = $dbh->prepare("insert into products (pname, unit, qty, c +ost) values (?, ?, ?, ?)"); ... $addprod->execute('apple', 'kg', 1, 1.99); ... $dbh->commit();#commit for each unit of work, or rollback, for really +simple cases, you can turn on AutoCommit ... $dbh->disconnect();