If your script uses DBI and either DBD::CSV or DBD::AnyData (depending on what kind of flat-file it is), then you're most of the way there. If not, then convert your
script to use those modules, and then the switch to MySQL
(and DBD::mysql) should be easy.
(But you probably should be using the native import
utility as suggested below, unless you need to massage
the data in a way that the import utility won't handle...)