#!/usr/bin/perl
#
# Check for teams which have all 9 starters above average
#    according to some statistic.
#    Try OPS+.
#
# MWR 1/7/2006

$debug = 0;

@starter_files = glob("team_stats/*_starters*dat");
foreach $file (@starter_files) {

  if ($debug > 0) {
    printf "next is file $file \n";
  }

  $found = 0;
  $sum = 0;

  open(FILE, "$file") || die("can't open file $file");
  while (<FILE>) {
    $line = $_;
    chomp($line);
    if ($line =~ /^#/) {
      next;
    }
    $ops_plus = substr($line, 123, 5);
    if ($debug > 0) {
      printf "line ..%s..  ops+ ..%s.. \n", $line, $ops_plus;
    }
  
    if ($ops_plus > 100) {
      $sum++;
    }

  }
  close(FILE);

  if ($sum >= 8) {
    $found = 1;
  }
  
  if ($found == 1) {
    printf " team $file sum %2d \n", $sum;
  }
  
}



exit 0;
