phoneyhits

来自「this gives details of the network progra」· 代码 · 共 49 行

TXT
49
字号
#!/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 (<F>) {    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 $!; if ($#lines<0) {    printf(F "$mon $day $year %s", randhits());} else {    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));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?