MySQL offers locking - each application.pl can lock the table, insert, and then release their lock to allow another application.pl to insert.
Note that only 1 application.pl can be inserting at any time.
This will not, however, help with your desire to share connections to the database.