package Devel::Count;
sub DB::DB { ++$count }
END { print "Total statements: $count\n" }
Now perl -d:Count program.pl prints out:
Total statements: 286