In Perl, what is the difference between use and require for loading a module?

后端 未结 4 566
一生所求
一生所求 2021-02-03 22:24

What is the difference between doing use My::Module and require My::Module?

4条回答
  •  抹茶落季
    2021-02-03 22:56

    From perldoc -q "difference between require and use":

    use Module is like require Module, except that use

    4.1: loads the module at compile time, not run-time.

    4.2: imports symbols and semantics from that package to the current one.

提交回复
热议问题