in reply to Problem of context?

pabla23:

Not only would variable test2 not be seen, the program wouldn't even compile. Try posting the code you actually run or don't gratuitously paste in a "use strict; use warnings;" at the beginning if you're not actually using them.

...roboticus

When your only tool is a hammer, all problems look like your thumb.