my @COLUMNS; push ( @COLUMNS, $_)for ( 1 .. $last_column ); my $column_list = map { print "field$_, " } @COLUMNS; my $placeholders = { print "?, " for ( 1 .. $last_column ) }; my $insert_data = $dbh->prepare(<) { my (@ROW) = split /,/, $_; my $row_list = map { print "\'$_\', " } @ROW; $insert_data->execute($row_list); } #### DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '61 ) VALUES ( 61 )' at line 1 at ./generatefiles.pl line 87, line 467.