in reply to problem with global variables going out of scope

our $showPUV declares a package global, and my $showPUV declares a lexical variable. You've got two entirely different variables called $showPUV, which naturally leads to very confusing results. You certainly shouldn't be declaring package globals inside a subroutine; that's just begging for trouble.

Check out Coping with Scoping.