could not in good conscience answer this in full for I once was a teacher, too. so let me do two things to point
you in the right way.
- you're on the right track. refine what you have and it will work. break everything down to distinct actions.
literally, speak your program out as a paragraph, then break the code up to match the sentances. test each piece
on it's own and as they work put them together.
- look up Elements of Programming with Perl at your local library/bookstore. don't buy it if you don't want,
but it has an example almost exactly like this assignment you could model your program from.
Hope that helps.
"A man's maturity -- consists in having found again the
seriousness one had as a child, at play." --Nietzsche