in reply to Help with 'use Warnings' please?

I guess the warning you were getting was Variable "$Globalvariable" is not available. If you look in the perldiag manual page, you see an explaination of what is happening (look for the first reason). You should then be able to fix it.

Replies are listed 'Best First'.
Re^2: Help with 'use Warnings' please?
by wa4otj (Beadle) on Jul 13, 2009 at 17:22 UTC
    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

      Did you try making $GlobalVariable a package variable?
        Yep. No difference.