in reply to Re: Perl to monitor a table in database
in thread Perl to monitor a table in database

This will give you the difference in record counts, not the number of records added. For example:

t + 1: add 5 rows t + 10: add 5 rows t + 20: del 20 rows t + 30: add 5 rows t + 50: add 10 rows

Your code would give an answer of 5 if $ct1 was obtained at time t. moritz's trigger answer would give a more accurate answer if you actually need the could count [1] of items added, and not just the difference in the row counts.

Updates:

  1. Fixed spelling mistakes.

--MidLifeXis