use warnings; my $Timer; my $Display; # This is the Canvas where the widgets are drawn {main code skipped over} sub showProblem { $Timer = $Display->after(shift, sub { $Globalvariable = blah blah blah... $Timer->cancel(); }); }
I get a warning
Variable "$Globalvariable" may be unavailable at some line number...
It seems that putting the global in an anonymous sub is a problem here, although warning aside, the code works perfectly. Yet I have other cases (with the same variable) where Warnings does not complain. Further, if there are two references to $Globalvariable in the anonymous sub, the second one does not generate a warning.
Any clue as to why this might be? I can eliminate the message by the use of "no warnings" in the anonymous sub, but I'm still confused by why I would need to do this. What is the Warnings pragma trying to tell me that I am too stupid to see?
Please educate me...
Nat
In reply to Help with 'use Warnings' please? by wa4otj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |