I'm not quite sure why you're using
XBase instead of
DBD::XBase. Also, you might consider using
DBD::CSV for writing the file to avoid the hand parsing and ensure proper embedding and quoting. By using DBI for all three purposes (reading the .dbf, writing the CSV, loading the MySQL data), your code should be easier to maintain.