in reply to mysqldump files

how mysqlimport can read the proper number of records but perl cannot is a mystery to me.

Because you wrote the code, and you don't know what you're doing?