You have to narrow the scope of the problem down to some well defined paramaters:
What consitutes a word?
What constitutes word boundaries?
What constitutes a sentence?
The simplest set of parameters is that spaces divide words, words are any non-white space characters, and sentences end with one of a few punctuation marks: .?!
Context is ignored. All you will do is find a few patterns and increment your counters based on those few patterns.
You actually have the right idea although there is an error in your code in this line:
CODE
if(Schar=~/[A-Za-z]/)
You could go about this in one of several ways but I think your code is probably OK for a student and especially for a beginner. Showing you how to do this a better way would not be helpful since it will more than likely leap-frog ahead of your current lesson.