SAC BUNTS 5346|Ron Villone|17|Cincinnati Reds|1 SAC FLIES 5746|Pokey Reese|17|Cincinnati Reds|1 STOLEN BASES 4159|Dante Bichette|17|Cincinnati Reds|1|2 CAUGHT STEALING 5602|Edgar Renteria|24|St. Louis Cardinals|1|3 PITCHING 24|St. Louis Cardinals 4379|Andy Benes|L, 2-2|0|6|8|3|3|0|0|1|24|31|41|72|4.41|.258 4625|Heathcliff Slocumb|0|0|1|0|0|0|0|0|0|4|3|8|11|4.08|.231 4979|Mike Mohler|0|0|1|0|0|0|1|3|0|4|8|9|17|8.79|.293 #### open(INPUT,"c:/MLB_boxscore.TXT") or die "Can't open file"; print "My page"; print ""; my $insection = ""; while () { if (/^SAC\s+BUNTS/) { $insection="sac bunts" } if (/^SAC\s+FLIES/) { $insection="sac flies" } if (/^STOLEN\s+BASES/) { $insection="stolen bases" } if (/^CAUGHT\s+STEALING) { $insection="caught stealing" } if (/^PITCHING/) { $insection="pitching" } if(defined($oldsection) && $insection ne $oldsection) { undef $oldsection; } elsif (defined($oldsection) && $insection eq $oldsection) { if ($insection == "scoring position"){ last if /^([A-Z][A-Z\s]*)/; chomp; @LS = (); push @LS, split('\|',$_); print ""; print "" for (1..$#LS); print ""; } } elsif ($insection && !defined($oldsection)) { $oldsection = $insection; next; } } print "
" . $LS[$_] . "
"; close INPUT;