my $sth = $dbh->prepare("INSERT INTO staff (first_name, last_name) VALUES (?, ?)"); my $tuples = $sth->execute_array( { ArrayTupleStatus => \my @tuple_status }, \@first_names, \@last_names, ); if ($tuples) { print "Successfully inserted $tuples records\n"; } else { for my $tuple (0..@last_names-1) { my $status = $tuple_status[$tuple]; $status = [0, "Skipped"] unless defined $status; next unless ref $status; printf "Failed to insert (%s, %s): %s\n", $first_names[$tuple], $last_names[$tuple], $status->[1]; } } #### my $sth = $dbh->prepare("INSERT INTO temp_selectedTitles VALUES (?)"); my $tuples = $sth->execute_array( { ArrayTupleStatus => \my @tuple_status }, \@books, ); if ($tuples) { print "Successfully inserted $tuples records\n"; } else { for my $tuple (0..$#books) { my $status = $tuple_status[$tuple]; $status = [0, "Skipped"] unless defined $status; next unless ref $status; printf "Failed to insert (%s): %s\n", $books[$tuple], $status->[1]; } }