You can use DBI to connect to the DB directly from perl and do whatever queries you want. It isn't overly complicated and there are a few posts around the forums that cover it. Here is one that has a bit of info:
http://www.eqemulator.org/forums/showthread.php?t=36355