Sounds like a poor mans version of turnitin. Well a couple of things.
- Your open syntax is not valid
- Looks like a CGI program - so use CGI
- You haven't read in the contents of the file
- Splitting on just a period is not going to help - what about ?, !, ;
- What if the sentences are slightly out of order ... you may want to sort