2001/11/12 (月) 13:26:46        [mirai]
#!/usr/bin/perl

$countfile  = './c';
$countlevel = 2;

	my ( @count, @filenumber, @sortedcount, $maxcount, $mincount );
	
	for ( $i = 0 ; $i < $countlevel ; $i++ ) {
		open ( IN, "$countfile$i.dat" );
		$count[$i] = <IN>;
		$filenumber{$count[$i]} = $i;
		close ( IN );
	}
	
	@sortedcount = sort { $a <=> $b; } @count;
	$maxcount = $sortedcount[$countlevel-1];
	$mincount = $sortedcount[0];
	
	$maxcount++;
	
	open ( OUT, ">$countfile$filenumber{$mincount}.dat" );
	print OUT $maxcount;
	close ( OUT );

##

	$ctl_len = length($maxcount);
	for ($i = 0; $i < $ctl_len; $i++) {
		$fn= substr($maxcount,$ctl_len,$i);

		open(CIMG,"$fn.gif");
		binmode(CIMG);
		print "Content-type: image/gif\n\n";
		binmode(STDOUT);
		while(<CIMG>){
			print;
		}
		close(CIMG);
	}
	
	exit;