in reply to Create database from perl script help
What kind of database are you using? This sounds an awful lot like a job for a Stored Procedure.