#!/usr/bin/perl require 'jcode.pl'; open (LOG,'./score.txt'); @logs = ; close LOG; # コメントとエントリの基点ID $c_start = 3641; $e_start = 2820; # エントリのタイトル末尾に「SS」があるときの加算点数 $e_bonus = 7; # そのほかのエントリの加算点数 $e_score = 5; # コメントの場合の加算点数 $c_score = 1; print "Content-type: text/plain\n\n"; foreach (@logs) { $_ =~ s/\n//; ($kind,$id,$times,$name,$title) = split(/\t/,$_); if (!$name || $kind eq 'C' && $id < $c_start || $kind eq 'E' && $id < $e_start) { next; } jcode::tr(\$name, '0-9A-Za-z', '0-9A-Za-z'); if ($kind eq "E" && $title =~ /SS\]$/i) { $score{$name} = $score{$name} + $e_bonus; } elsif ($kind eq "E") { $score{$name} = $score{$name} + $e_score; } else { $score{$name} = $score{$name} + $c_score; } } @names = sort({ $score{$b} <=> $score{$a} } keys %score); #open (OUT, '>./output.txt'); foreach $sc (@names) { $count++; print "document.write('[$count] $sc [$score{$sc} pts]
')\n"; if ($count >= 10) { last;} } exit;