#!/bin/perl

$file  = "../data/count";
open FILE, "<$file";
$count = <FILE>;
close FILE;
chomp $count;

$sum = 0;
$file = "../data/voting";
open VOTING, "<$file";
while (<VOTING>) {
 ($votecount) = $_ =~ /,([0-9]*),/;
 $sum = $sum + $votecount;
}

($ss,$mm,$hh,$dd,$mon,$yy,$we,$doy,$st)=localtime;
$date = sprintf "%02d.%02d.%d %02d:%02d",$dd,$mon+1,$yy+1900,$hh,$mm;
open OUT, ">>../data/count_vote_hist";
print OUT "$date,$count,$sum\n";
close OUT;

