--- processmail/collection.pl 2005/01/24 03:16:35 1.3 +++ processmail/collection.pl 2005/02/16 22:25:59 1.4 @@ -1,21 +1,29 @@ #!/usr/local/bin/perl # -#$Id: collection.pl,v 1.3 2005/01/24 03:16:35 boris Exp $ +#$Id: collection.pl,v 1.4 2005/02/16 22:25:59 boris Exp $ # # Собрание сочинений # use Getopt::Std; -$usage = 'collection.pl $Revision: 1.3 $, $Date: 2005/01/24 03:16:35 $'. "\n". -"Usage: collection.pl [-d] [-t table_file] [-m mail_file] [-o results] \n"; +$usage = +"Usage: collection.pl [-d] [-t table_file] [-o results] \n"; require 'parameters.pl'; require 'subroutines.pl'; -die $usage unless getopts('t:m:o:d'); +die $usage unless getopts('t:o:d'); $DEBUG=$opt_d; +# Находим максимальный вопрос +$MAXQUEST=1; +for (my $i=1; $i<=$ROUNDS; $i++) { + if ($MAXQUEST<$MAXQUEST[$i]) { + $MAXQUEST=$MAXQUEST[$i]; + } +} + my %teams; @@ -33,21 +41,15 @@ if ($opt_t) # # Читаем ответы команд # -if ($opt_m) -{ - die "Cannot open $opt_m\n" unless open(INFILE,$opt_m) -} -else -{ - *INFILE=*STDIN; +for (my $i=1; $i<=$ROUNDS; $i++) { + foreach my $file (split /\s+/, $FILES[$i]) { + open (INFILE, $file); + readmail(\%teams); + collect_answers(\%teams,\@answers); + close (INFILE); + } } -readmail(\%teams); -close(INFILE); -# -# Чистим хэш %answers -# -collect_answers(\%teams,\@answers); -# + # Пишем измененную таблицу в файл. # if ($opt_o)