in reply to Re: Where and when you should place 'use module;'?
in thread Where and when you should place 'use module;'?
By using a require statement, the module will only be loaded at runtime of that line, which means IFF sub1() is called. The huge advantage here is that Module1 is only loaded into memory when (if ever) needed, which could be a big time/memory saver if it is a large module, especially if memory footprint is an issue.use ModuleUsed::LoadedAt::CompileTime; sub sub1 { require Module1; # loaded at runtime ... } ...
|
|---|