I think you're on the right track with unpack. Remember that you can use x in the templet to throw characters away so no need to undef them later. A couple questions to clarify, is you file arranged with one field name/value pair per line, and one file per record? Do the field-name / value pairs have a defined separator character or string? Can you show use an example of a file ( or the first couple lines or so ). Perhaps loading the file into an array (if the files are small in size) and then using split to break apart the name value pairs. Don't forget to filter the data for illegal characters that would cause problems when loading into the database or by sure to quote them properly.