in reply to Re: Help with 'use Warnings' please?
in thread Help with 'use Warnings' please?

I looked at the page mentioned, and I guess I'm too dense today to get it. The explanation of "An inner (nested) anonymous subroutine is inside a named subroutine, and outside that is another subroutine; and the anonymous (innermost) subroutine is referencing a lexical variable defined in the outermost subroutine." doesn't grok because the only outer sub is the main program.

The anonymous sub is indeed inside a named sub, it is true, but there is no "outer" sub, unless the main program counts. I also do not see how the anonymous sub could be called when "the outermost sub is not active" since the only possible way to get there is via the named sub. I guess my ignorance is showing.

I tried changing the anonymous sub to a named sub, but that breaks the code in other ways. Fixes are possible, but the code then becomes a fair bit more complex, so IMHO this warning is simply bogus and should just be ignored.

So, is there a better fix, or is a permanent 'no warnings' in the anonymous sub the way to go?

Nat

Replies are listed 'Best First'.
Re^3: Help with 'use Warnings' please?
by JavaFan (Canon) on Jul 13, 2009 at 17:56 UTC
    Did you try making $GlobalVariable a package variable?
      Yep. No difference.