in reply to DBI insert statement

The first step in writing Perl to do a complex SQL interaction is to write SQL statement(s) from your DB's command line that does what you want in SQL, at least for one record.

The Perl DBI is fantastic and SQL statements translate very directly into Perl.