On Nov 16, Ray Murphy said: >When using modules, is it better to say 'use >Foo::Bar;' rather than 'require'. Also I've noticed >that some people put their 'use' or 'require' >statements in subroutines and not at the beginning of >the program - what benefits does this serve - conserve >memory because as soon as you've left the routine the >module goes bye bye (guessing)?? But surely the >library would have to compile everytime the subroutine >would be called and therefore slow the program down >somewhat (again, guessing).
The FAQ has an answer for this: "What's the difference between require and use?" Check http://www.perldoc.com/, and look in perlfaq8. The skinny is this: 1. require() happens at run-time, and either takes a bareword module name or a path to a file (not necessarily a module) 2. use() happens at compile-time (so putting it in a function doesn't "help") and it involves require()ing a module and then calling its import() method -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]