in reply to Understanding use and require fully

What's the difference between require and use?
  • Comment on Re: Understanding use and require fully

Replies are listed 'Best First'.
Re^2: Understanding use and require fully
by msk_0984 (Friar) on Aug 02, 2008 at 09:12 UTC
    Hey,

    Here are few differences bewteen use and require which may make it more clear for you.

    • use only expects a bareword, require can take a bareword or an expression
    • use is evaluated at compile-time, require at run-time
    • use implicitly calls the import method of the module being loaded, require does not
    • use excepts arguments in addition to the bareword (to be passed to import), require does not
    • use does not behave like a function (i.e can't be called with parens, can't be used in an expression, etc), whereas require does


    Sushil Kumar