I just wanted to know about the advantages and disadvantages of "require" over "use" in Perl.
I know that :
1. "use" is evaluated at compile time and "require" at run-time.
2. If the module I am using with "use" has syntax error they will be thrown while compiling, on the contrary if the module is "require" ed then they will come during run-time and no errors will be reported in compile time.
3. When we do "use", the control is passed to that file at run-time and whereas in case of "require" the code from that module/file is included to my code which is "require"ing it at run-time.
4. If I have a module which does a lot in the BEGIN block and I don't really need it in all cases , then it is clever to "require" it so that I won't have to wait for all the initializations of that module in case I don't need it.
My question is :
is there any gain in terms of memory consumption when I use "require" or any other advantage ? Please let me know.