Instead of writing the information to another textfile, why not create objects using
Class::DBI and save those directly to the database? You can use the find_or_create method to avoid creating duplicates should you need to run the file more than once.