use and require do different things, so there really is no comparison here. use is a compile-time directive, while require is a run-time directive (happens after the script starts executing).
In addition, use Foo imports all of the symbols (variables, subroutines, etc.) that the module exports, while require doesn't.
I doubt there's that much of a speed difference when you add in the code that would make the second method do what the first does. The first is also *way* easier to maintain.
Your best optimizations in this area come with using only the modules you *need* and importing only the symbols you *need*.
HTH!
perl -e 'print "How sweet does a rose smell? "; chomp $n = <STDIN>; $r +ose = "smells sweet to degree $n"; *other_name = *rose; print "$other +_name\n"'
In reply to Re: Efficiently loading modules
by arturo
in thread Efficiently loading modules
by symŽ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |