in reply to DBI and transactions

Before even considering commit vs. rollback, you should add AutoCommit=>0 to the DBI constructor call. Otherwise, the DBI will automatically commit all transactions, rendering both the rollback and commit calls meaningless.

The 1552 rows in table A are most likely from failure to use AutoCommit=>0 in the DBI constructor. Databases that don't fully expose transactions (e.g., MySQL hides its transactions from the user) will fatally error with AutoCommit=>0; others, such as MS SQL, should do what you expect once that's in.

The commit call is in the right location for the desired effect.