You've got a $showPUV declared with my at the top, and one declared with our in the sub. Is that what you want? They are different variables, the former being declared lexically, and the latter being a global.
You don't say specifically what variable goes out of scope when, so it's hard to tell you why it's happening.