in reply to Optimizing a web application for the best performance
I've been thinking "use" and "no" would be of use inside a subroutine to save memory at that time but found out the hard way the "no" did nothing at all to the memory. Probably using "no" will be even a performance hit everywhere over my scripts?'use' lines are evaluated when your script is compiled, before anything else, so even if you place them in a sub, those modules will be loaded when the script is compiled and before that sub is executed.
You can get round this to only load a module when the sub runs by using require or eval:
sub foo { require Module; import Module; } sub bar { eval(use Module); }
|
|---|