The particular bug that's causing the error message you're referring to is in the reset_game() sub.
The problem is that you're assigning a single scalar value '0' to a list. That means that $all_occurrences becomes undefined. Use an undefined value within a character class in a regexp and you get an error message. Try the followng:
perl -e "my $var; 'string'=~/[$var]/"
And here's the error...
Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE ]/ at -e line + 1.
If you're getting warnings when running under warnings and strictures, the goal is to understand why. The warnings are telling you something. In this case, you mentioned getting uninitialized value warnings. Instead of fixing the problem, you subverted the warnings, and that allowed bugs to creep in. If you had dug into why you were getting those undefined value warnings, you would have tracked the problem down to your reset sub.
Dave
In reply to Re^3: Resetting variables
by davido
in thread Resetting variables
by yacoubean
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |