a quick perl script I hacked to test the counter logic