I would discourage the usage of "split /,/, $record" as the method for determining the number of fields and, therefore, placeholders. The problem here is that his data fields may contain commas in them; e.g.,
'foo','bar',1,23,'foobar,bar,foo'
in which case "split /,/, $record" won't return proper results.
Text::CSV and
DBD::CSV are probably more appropriate.
--perlplexer