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.
In reply to Re: Why don't *glob assignments affect the current pacakge?
by hv
in thread Why don't *glob assignments affect the current pacakge?
by jimav
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |