#!/usr/local/bin/perl # # add a line of phoney hitcounts for today to hitlist # $max = ($ARGV[0] || 1000); printf("Using $max\n"); $_ = `date "+%m %d %Y"`; chomp; ($mon,$day,$year) = split; open(F,"hitcount") || die $!; while () { chomp; ($m,$d,$y) = split; if (($m==$mon)&&($d==$day)&&($year=$y)) { $lines[$i++] = sprintf("$mon $day $year %s", randhits()); } else { $lines[$i++] = $_; } } close(F); open(F,">hitcount") || die $!; for ($i=0;$i<=$#lines;$i++) { printf(F "$lines[$i]\n"); } close(F); sub randhits { my($i); my(@nums); srand; for ($i=0;$i<24;$i++) { $nums[$i] = int(rand($max)); } return(join(" ",@nums)); }