your own solution and the various text::csv module solutions provided do the trick. but if it matters (if the output is going back into a database especiallly,) do some sanity checks that you do have the prerequisite number of fields on input, and that they're of desired format, e.g. field one is a valid product code etc, and field 9 is a fairly valid number. for the second case, adding a zero to field 9 should be mathematically equal to field 9.