in reply to Perl DBI and mySQL

In the SQL you're using, you have your values in one big quoted string (VALUES ("a,b,c...")) instead of as individual values (VALUES ("a", "b", "c")). What you really should do is use placeholders for this.

my $cc = join q{,}, @col; my $qmarks = join q{,}, map { '?' } @values; my $sql_2 = qq{INSERT INTO mfa.genome ($cc) VALUES ($qmarks)}; $DBHandle->do( $sql_2, undef, @values );

A few more things stand out here.

  1. You seem to be populating @col with only the first column of every row you fetch from $hi (whatever that is). Is that really what you meant? I guess you can see from your value of $cc later if it's right.
  2. You push into @values, but I don't see that it gets cleared anywhere.
  3. The way you're adding to @values is very not Perlish. You could do the same thing as: push @values, @org[0..9]
  4. With DBI, you can do() without prepare(). (prepare() is for when you will later execute().)
  5. The @values you had were going to be passed unquoted to the database. This means that if the values themselves had what looked like SQL code in them, that could be executed. Using placeholders takes care of that, but you can also use the quote() method on a database handle.
  6. According to the indents, your SQL stuff is happening inside the while loop, but according to the braces, it's outside. Be sure you're looping over what you want to.