in reply to MySQL: trouble inserting an array with some undefined members into a table using a set number of placeholders

As others have suggested, your data probably contains more colons than you expect on some lines, and a field like "notes_comments" probably has a decent chance of containing colons as data.

Try this one-liner on your "gleandata.csv" file, and see what you get:

perl -ne '$n=tr/://;$h{$n}++; END{ print "$h{$_} lines have $_ colons\n" for(sort{$a<=>$b} keys %h)}' < + gleandata.csv
(You should put that on the shell command line as a single line -- I just broke it up to avoid the bothersome "+" in the node display.)

If there were only one field that contained colons as data, and you could figure out how to make that field come last on each line, you could try doing your split like this:

my @row = split(/:/, $line, 24);
That way, only 24 elements will be returned, and any "extra" delimiters will just be kept inside the 24th element. But a better approach would be:

(updated last bullet point in hopes of making it clearer)

  • Comment on Re: MySQL: trouble inserting an array with some undefined members into a table using a set number of placeholders
  • Select or Download Code