Super Starz of Fantasy Wrestling



; } until ($line =~ /\w/); while ($line =~ /\w/) { chop ($line); $hitters[$hittercount ] = $line; $line = ; } $line = ; while ($line =~ /\w/) { chop ($line); $pitching[$pitchercount ] = $line; $line = ; } } else { @hitters = $ARGV[0]; @pitching = $ARGV[0]; } } sub get_addresses { local ($index, @split_index, @split_lines); $/ = ""; &sign_on; print SOCK "GET $page HTTP/1.0\n\n"; $index = ; close (SOCK); if (@ARGV[1] ne "today") { @yesterday = split (/for ; close (SOCK); } @new_index = split (/


/, $index); @split_index = split (//) { $line =~ s/>
  • .*//; $line =~ s/<[^>]>//g; $line =~ s/\n//g; } else { $line = ""; } } return (@split_index); } ######### Socket connection subroutines sub sign_on { local($sockaddr,$here,$there) = ("Snc4x8"); $here = pack($sockaddr,2,0,&get_tcp_address($client_addr)); $there = pack($sockaddr,2,80,&get_tcp_address('wsf1.usatoday.com')); die "socket: $!\n" if (!socket(SOCK,2,1,6)); die "connect: $!\n" if (!connect(SOCK,$there)); select(SOCK); $| = 1; select(STDOUT); $| = 1; } sub get_tcp_address { local($host) = @_; local(@ary); @ary = gethostbyname($host); return(unpack("C4",$ary[4])); } ########## OK, OK, the real main program... sub get_file { local ($url) = @_; local (@split_box, @hitter_section, @pitcher_section, $game); if ($url !~ /\//) { $first_url = $url; $first_url =~ s/(\d\d\d\d\d).*/$1/g; $first_url .= "/"; } $/ = ""; &sign_on; print SOCK "GET /sports/scores97/$first_url$url HTTP/1.0\n\n"; $game = ; close (SOCK); @split_box = split (/--------------------------------------------------/,$game); @hitter_section = split(/

    /, $split_box[0]); @pitcher_section = split (/

    /, $split_box[2]); unshift (@hitting_line, &get_hitter_lines (grep(/rbi bb/, @hitter_section))); unshift (@homer_line, &get_homers (grep(/BATTING/, @hitter_section))); unshift (@steal_line, &get_steals (grep(/BASERUNNING/, @hitter_section))); unshift (@pitching_line, &get_pitcher_lines (grep(/r er/, @pitcher_section))); } ########### sub get_hitter_lines { local (@lines) = @_; local (@away, @home, @batter_line, @hitting_total); print $lines; @away = split (/\n/, $lines[1]); shift (@away); @home = split (/\n/, $lines[0]); shift (@home); unshift (@away, @home); foreach $batter (@hitters) { @batter_line = grep (/$batter/, @away); unshift(@hitting_total, @batter_line); } return (@hitting_total); } sub get_homers { local (@homers) = @_; local (@homers_away, @homers_home); local (@split_homers_away, @split_homers_home); local (@homer_totals, @homer_totals_part2); local (@homer_results, @team_total); if ($homers[0] =~ /HR/) { @homers_away = split(/HR/, $homers[0]); @split_homers_away = split(/\./,$homers_away[1]); } if ($homers[1] =~ /HR/) { @homers_home = split(/HR/, $homers[1]); @split_homers_home = split(/\./,$homers_home[1]); } @homer_totals = split(/;/, $split_homers_away[0]); @homer_totals_part2 = split(/;/, $split_homers_home[0]); unshift(@homer_totals, @homer_totals_part2); foreach $line (@homer_totals) { $line =~ s/\n/ /g; $line =~ s/\r/ /g; $line =~ s/ / /g; $line =~ s/^ //g; $line =~ s/ ?- ?//g; $line =~ s/ ?\(.*\)//g; } foreach $batter (@hitters) { @homer_results = grep (/$batter/, @homer_totals); unshift(@team_total, @homer_results); } return (@team_total); } sub get_steals{ local (@steals) = @_; local (@away_steals, @home_steals); local (@steal_totals, @steal_totals_part2); local (@steal_results, @team_total); if ($steals[0] =~ /C[Ss]/) { @away_steals = split(/C[Ss]/, $steals[0]); } else { @away_steals = $steals[0]; } if ($steals[1] =~ /C[Ss]/) { @home_steals = split(/C[Ss]/, $steals[1]); } else { @home_steals = $steals[1]; } $away_steals[0] =~ s/Baserunning: ?//i; $home_steals[0] =~ s/Baserunning: ?//i; $away_steals[0] =~ s/ ?Sb ?- ?//i; $home_steals[0] =~ s/ ?Sb ?- ?//i; @steal_totals = split(/;/, $away_steals[0]); @steal_totals_part2 = split(/;/, $home_steals[0]); unshift(@steal_totals, @steal_totals_part2); foreach $line (@steal_totals) { $line =~ s/\n/ /g; $line =~ s/\r/ /g; $line =~ s/ / /g; $line =~ s/^ //g; $line =~ s/ ?\(.*\)//g; $line =~ s/\. ?//g; } foreach $batter (@hitters) { @steal_results = grep (/$batter/, @steal_totals); unshift(@team_total, @steal_results); } return (@team_total); } sub get_pitcher_lines { local (@lines) = @_; local (@away, @home, @pitcher_line, @pitching_total); @away = split (/\n/, $lines[1]); shift (@away); @home = split (/\n/, $lines[0]); shift (@home); unshift (@away, @home); foreach $pitcher (@pitching) { @pitcher_line = grep (/$pitcher/, @away); unshift(@pitching_total, @pitcher_line); } return (@pitching_total); } ######################## sub printout { &print_hitters; &print_homers; &print_steals; &print_pitchers; exit; } sub print_hitters { local (@hitting_columns, @hct, $batting_average); print "\n ab r h rbi bb so lob avg\n"; foreach $line (@hitting_line) { print "$line\n"; @hitting_columns = split (/\s /, $line); #Deal with indented names shift (@hitting_columns) if ($hitting_columns[0] !~ /\w/); #Deal with first names shift (@hitting_columns) if ($hitting_columns[2] !~ /\d$/); for ($count = 2; $count < 9; $count ) { $hct[$count] = $hitting_columns[$count]; } } $batting_avg = ($hct[4]/$hct[2])*1000 if ($hct[2] > 0); $~ = "TOTALS"; write; } sub print_homers { local ($homers); $homers = join (", ", @homer_line); print "\nHomers:\n\t$homers.\n" if ($homers ne ""); } sub print_steals { local ($steals); $steals = join (", ", @steal_line); print "\nStolen Bases:\n\t$steals." if ($steals ne ""); } sub print_pitchers{ local (@pitching_columns, @pct, $era, $ratio); print "\n\n ip h r er"; print " bb so hr era ratio\n"; foreach $line (@pitching_line) { print "$line\n"; $line =~ s/\(.*\)//g; @pitching_columns = split (/\s /, $line); shift (@pitching_columns) if ($pitching_columns[0] !~ /\w/); shift (@pitching_columns) if (@pitching_columns[1] !~ /\d$/); if ($pitching_columns[1] =~ /\//) { $pitching_columns[1] = ".667" if ($pitching_columns[1] =~ /2/); $pitching_columns[1] = ".333" if ($pitching_columns[1] =~ /1/); } if ($pitching_columns[2] =~ /\//) { $pitching_columns[1] = .667 if ($pitching_columns[2] =~ /2/); $pitching_columns[1] = .333 if ($pitching_columns[2] =~ /1/); splice (@pitching_columns, 2, 1); } for ($count = 1; $count < 8; $count ) { $pct[$count] = $pitching_columns[$count]; } } $era = ($pct[4]/$pct[1])*9 if ($pct[1] > 0); $ratio = ($pct[2] $pct[5])/$pct[1] if ($pct[1] > 0); $~ = "PTOTALS"; write; print "\n\n"; } format TOTALS = Totals: @# @# @# @# @# @# @# .@## $hct[2], $hct[3], $hct[4], $hct[5], $hct[6], $hct[7], $hct[8], $batting_avg . format PTOTALS = Totals: @#.# @# @# @# @# @# @# @.## @.### $pct[1], $pct[2], $pct[3], $pct[4], $pct[5], $pct[6], $pct[7], $era, $ratio> .





    Here are some of my favorite links:






    Email: goblue@newnorth.net


    Number of visits to this page:





    Space for this web page is provided as a service by InfoLanka.
    The contents of this page are the responsibility of its creator, not InfoLanka