in reply to Parsing a Text File 2

you need to create more elsif's for each of the sections. A better solution would be to change the name of the $pitching variable to something like $insection to keep track of what section you are in. Then you can compare that to another variable to see if the section has changed since the last input line. IE:
my $insection = ""; while (<INPUT>) { if (/^PITCHING/) { $insection="pitching" } if (/^DOUBLE\s+PLAYS/) { $insection="double plays" } if(defined($oldsection) && $insection ne $oldsection) { undef $oldsection; } elsif (defined($oldsection) && $insection eq $oldsection) { #print the HTML forms here } elsif ($insection && !defined($oldsection)) { $oldsection = $insection; next; } }
there's probably a better way to do it - but this works. NOTE: You must add if statements for all headings you wish to stop at (following my example of the DOUBLE PLAYS match). HTH!

-Adam Stanley
Nethosters, Inc.