In Perl you use the DBI database interface. In your case, you will also be using something like the DBD::MySQL driver.
There is lots of help available on this topic (including lots of questions on this site).
As for the specific question of your .sql file, there are a few approaches you could take, depending on how fancy you want to get:
- You could just copy and paste the commands into your program as you write it.
- You could execute an external program that will run the .sql file (for example, by using
system()).
- You could programmatically read in the .sql file and send the commands from within your program. A module could help you with this (I found
SQL::Script on CPAN, which looks useful, though I don't have any experience with it).
I suggest you pick an approach, try it, and ask if you have any specific problems.