Using strict as well as warnings would probably help.
Looking at perldiag at the entry for the warning which is closest what is quoted by the OP, using strict would not help. In fact, it can only happen with lexicals - it shouldn't happen with package variables.
I could have posted the entire example, but it would have been much too long. I am using strict, and the code I posted does in fact show pretty much exactly what is going on.
The best way to get help here is to post a self-contained program which exhibits your problem. If we can run your program, then it's far more likely that we'll be able to find the issue.
I find that in the process of cutting a program down to an example that illustrates a particular problem, it often gives me a different perspective and enables me to find a solution without even posting here.