Here is an example of how to use perl to communicate with a mysql database using the DBI module. This example shows an insert to a table with 3 fields:

#!/usr/bin/perl

use DBI;
use strict;
use warnings;
# Database settings
my $database = "database";
my $username = "username";
my $password = 'password';
my $table = "items";
# Connect to database
my $dbh = DBI->connect("dbi:mysql:database=$database;host=localhost;user=$username;password=$password") or die "Couldn't connect to database: $DBI::errstr\n";
#### DB ENTRY
# Insert matches into table
my $sth = $dbh->prepare("INSERT INTO $table VALUES (0,'$value','$value2')") or die "Couldn't prepare statement: $dbh->errstr\n";
$sth->execute() or die "Couldn't execute query 'sql': $DBI::errstr\n";

The 0 is inserted as the first variable in this table because the field is an auto incrementing value that we want mysql to number.