Since I haven't really studied how Perl and SQL go along, I'd have a look at some sample Perl scripts, make my own library to use with UBB that could connect to the database, and finally a sub routine to retrieve and post the record from the database.
A good resource for Perl programming is at
The CGI Resource Index .
Maybe that'll point you in the right direction.