BEGIN blocks run before the rest of the code in the module is even interpreted, so at the time when BEGIN { say __PACKAGE__."::begin $variable"; } runs, the lexical variable $variable has not been created, so the global variable of that name is used, and it has no value; hence the warning.
Solution: don't close over lexical variables in BEGIN blocks.
In reply to Re:Use of uninitialised value... but it is defined ?!
by BrowserUk
in thread Use of uninitialised value... but it is defined ?!
by seki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |