in reply to When is "use module" not the same as require+import?
Not exactly. The documentation says:
It is exactly equivalent toBEGIN { require Module; Module->import( LIST ); }
And the BEGIN{} block makes all the difference. The BEGIN means that the code is run immediately after Perl has reached the closing curly brace. Which is well before Perl runs the code that initializes your @fields array. Putting the assignment to @fields into a(nother) BEGIN block would alleviate that problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: When is "use module" not the same as require+import?
by AZed (Monk) on Sep 18, 2008 at 19:23 UTC | |
by JadeNB (Chaplain) on Sep 18, 2008 at 20:34 UTC | |
by ikegami (Patriarch) on Sep 19, 2008 at 19:20 UTC | |
by Bloodnok (Vicar) on Sep 19, 2008 at 16:51 UTC |