in reply to Inserting large chunks of data into MySQL

You'll get an error if one of these variables contains a single quote '.

To avoid that (and to boost performance) use placeholders instead:

my $sth = $dbh->prepare("INSERT INTO ques(username, userque, ...) VALU +ES (?, ?, ...)"); foreach my $t (split '~', $txtque){ $sth->execute($usernamenow, $t, ...); }