Here is an example of something in a txt file:

5/4 team1 10 team2 7
5/4 team7 24 team4 17
5/4 team3 15 team5 12
5/11 team2 8 team5 20
5/11 team4 10 team3 23
5/11 team1 19 team7 3

I would like to be able to parse the teams, like this for team4:

5/4 team7 24 team4 17
5/11 team4 10 team3 23

In unix I used to simply use a GREP to do this kind of stuff but I don't know enough about PERL to do this.

Any ideas?
I tried all of the scripts that you provided. I must be doing something wrong. None of them gave anything back. I changed the name to cgi but that didn't help it either. Any ideas?