in reply to Why don't *glob assignments affect the current pacakge?
It isn't that the glob assignment is not coming into effect, but that you have a true strict error when you use $mainvar without declaring it. The issue then is rather: why is accessing an undeclared variable not a strict error after a glob assignment in a different package? (Note that if you properly declare our $mainvar, no error is raised in either variant).
I have a vague recollection that it is a long-standing deliberate exception - possibly a hack to help Exporter work, though I'm not confident of that. Certainly the behaviour goes back at least as far as perl-5.8.9, which is the oldest I have installed here; I suspect it was introduced sometime between 5.001m and 5.005.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why don't *glob assignments affect the current pacakge?
by haukex (Archbishop) on Aug 26, 2023 at 14:27 UTC | |
|
Re^2: Why don't *glob assignments affect the current pacakge?
by tobyink (Canon) on Aug 26, 2023 at 14:00 UTC |