# Step through array from 'start', making sure not to go past the end
if($db[$dbcount] =~ /\bpar\b|\bPar\b|\bPAR\b/)
{
# Look for header data
if($db[$dbcount + 1] =~ /^\W/)
{$par = $db[$dbcount] . $db[$dbcount + 1];}
else{$par = $db[$dbcount];}
(@par) = split(/\s+/, $par);
if($par[10] < 6)
{@par = &addOUTin(@par)}
$szpar = "" . @par;
$count = 0;
while($count < $szpar)
{
if($par[$count] =~ /\w+/)
{
$pushpar .= $par[$count] . " ";
}
$count++;
}
push(@final, $hole, $pushpar);
}
elsif(($db[$dbcount] !~ /^\W/) && ($db[$dbcount] !~ /STOP/))
{
# Look for player data
if($db[$dbcount + 1] =~ /^\W/)
{$player = $db[$dbcount] . $db[$dbcount + 1];}
else{$player = $db[$dbcount];}
(@player) = split(/\s+/, $player);
if($player[10] < 6){@player = &addOUTin(@player);}
$pcount = $dbcount + 2;
while($pcount < $szdb)
{
if($db[$pcount] =~ /$arg/)
{$tripped = 1;}
if(($tripped) && ($db[$pcount] =~ /STOP/))
{$tripped = 0;}
if(($db[$pcount] =~ /^$player[0]/) && ($tripped == 1))
{
if($db[$pcount + 1] =~ /^\W/)
{$newplayer = $db[$pcount] . $db[$pcount + 1];}
else{$newplayer = $db[$pcount];}
(@newplayer) = split(/\s+/, $newplayer);
if($newplayer[10] < 6){@newplayer = &addOUTin(@newplayer);}
$sznew = "" . @newplayer;
$compcount = 1;
while($compcount < $sznew)
{
$player[$compcount] = ($player[$compcount] + $newplayer[$compcount])/2;
$compcount++;
}
$tripped = 0;
}
$pcount++;
}
$szplay = "" . @player;
if($szplay > 10)
{
$count = 0;
$pushplayer = "";
while($count < $szplay)
{
if($player[$count] =~ /\w+/)
{
$pushplayer .= $player[$count] . " ";
}
$count++
}
push(@final, $pushplayer);
}
}
# Look for the end of the data
else{if($db[$dbcount] =~ /STOP/){last;}}
$dbcount++