How do I use constants from a Perl module?

前端 未结 6 1735
情书的邮戳
情书的邮戳 2020-12-23 11:37

If I define a constant in a Perl module, how do I use that constant in my main program? (Or how do I call that constant in the main program?)

6条回答
  •  醉话见心
    2020-12-23 12:16

    To expand on the earlier answers, since constants are really just subs, you can also call them directly:

    use Foo;
    print Foo::BAR;
    

提交回复
热议问题