in reply to Resetting variables

The code you included is not enough to duplicate your problem. In fact, it doesn't run because the print_word sub isn't defined. After defining it, I got a lot of complaints about the global variables, because I included
use strict; use warnings;
at the top of the program -- you should do that. Then I declared and initialized where necessary ($word_len and $tot_found need initial values), and ran the program without a problem (although it doesn't do anything interesting).

The error you describe strikes me as very quirky. You might get around it by tacking the "o" (compile once) option onto the regex:

/[[:alpha:]]/o

Caution: Contents may have been coded under pressure.