Here is a updated copy with Getopt::Long support.. Also fixed 'time' based calculations. http://www.engelken.net/download/sa-stats.txt
# perl sa-stats.txt --help usage: sa-stats.txt [-l <dir>] [-f <file>] [-n <num>] [-w] --logdir|-l <dir> Directory containing spamd logs --filename|-f <file> File names or regex to look for in the logdir --num|-n <num> Number of top rules to display, 0=all --web|-w Make it web friendly output --help|-h Prints this help Examples.. # parse all maillog* files in /var/log $ perl sa-stats.txt # /var/log/spamd/* (daemontools) $ perl sa-stats.txt -l /var/log/spamd -f .* - d