open(INPUT,"c:/MLB_boxscore.TXT") or die "Can't open file"; print "Box Score"; print ""; use strict; my $insection = ""; $y = 1; $l = 0; $/ = ""; $players1 = ; $totals1 = ; $players2 = ; $totals2 = ; $players = $players1; $totals = $totals1; players($players); totals($totals); print "\n\n"; $players = $players2; $totals = $totals2; players($players); totals($totals); print "
"; close INPUT; sub chomped{ $/ = "\n"; chomp; @LS = (); push @LS, split('\n',$player); return @LS; } sub players{ $players = $players; print ""; foreach $player($players){ chomped($player); foreach $LS(@LS){ chomp; @SL = (); push @SL, split('\|',$LS); for ($x=0;$x<=$#SL;$x++){ if ($x == 0){ $id = $SL[$x]; if ($id == $oldid){ print ""; } elsif ($x == 13){ print ""; } else { print ""; } } } } } sub totals{ $totals = $totals; foreach $total($totals){ chomp; @LS = (); push @LS, split('\|',$total); print ""; print "" for(0..$#LS); print "" for(0..2); print "
_"; } else { print "
"; } $oldid = $id; } elsif ($x == 1){ next; } elsif ($x == 2){ print $SL[$x]; } elsif ($x == 3){ print ", " . $SL[$x] . "" . $SL[$x] . "
" . $SL[$x] . "
" . $LS[$_] . "-
"; } }