Don't ask to ask, just ask | |
PerlMonks |
Re: Source files, packages and name spacesby Dinosaur (Beadle) |
on Apr 15, 2002 at 16:11 UTC ( [id://159251]=note: print w/replies, xml ) | Need Help?? |
Thanks for the replies, guys. Broquaint's example makes clear what the problem is. Code occurring outside of any sub just gets executed in sequence -- the package statement doesn't alter that sequence of execution. Things which *do* alter that sequence include reordering the code (broquaint), forcing its early execution with BEGIN (merlyn), or pulling it in early with require (my initial example). FWIW, I'd read about the $a/$b trap on previous visits here. Guess that sort of thing doesn't sink in until you get burned by actually doing it -- at least that's how I've learned just about everything else :( --Dinosaur
In Section
Seekers of Perl Wisdom
|
|