As others have asked, clean up the formatting of your post, with para and code tags. Then go back to your code and:
- Format with consistent indentation
- use strict; use warnings;
- Fix the warning items
- Fix the errors
- Test your corrections with perl -c wordguess.pl (or whatever name you're using for the code)
- Wash, rinse, repeat.
- When no warnings or errors are issued at 6, try to execute the program.
- (late addition: ) Now you're ready to insert debug statements to find your logical errors
If you get stuck, come back and show us (partially) corrected code and any msgs when you execute.