加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

子例程中的奇怪perl语法($$)

发布时间:2020-12-15 23:28:34 所属栏目:大数据 来源:网络整理
导读:参见英文答案 What does the function declaration “sub function($$)” mean?????????????????????????????????????2个 ($$)在此代码中的用量是多少.我已经对Perl进行了很长时间的编程,但直到最近我打开一个非常古老的Perl .plx文件时才会遇到这种语法 这
参见英文答案 > What does the function declaration “sub function($$)” mean?????????????????????????????????????2个
($$)在此代码中的用量是多少.我已经对Perl进行了很长时间的编程,但直到最近我打开一个非常古老的Perl .plx文件时才会遇到这种语法

这些行阻止我升级到更现代的Perl版本.

sub help( $$){

}

它影响我的原因是因为我收到一条错误消息,指出帮助函数在声明之前已被调用.知道如何在不删除($$)块的情况下解决这个问题吗?

解决方法

这是一个函数原型,用于指定子例程所采用的参数的数量和类型.见 documentation.

由于它在当前文档中,我不明白为什么它阻止您升级.

您是否过早收到错误以检查原型?以下是perldiag文档中的解释:

(W prototype) You’ve called a function that has a prototype before the parser saw a definition or declaration for it,and Perl could not check that the call conforms to the prototype. You need to either add an early prototype declaration for the subroutine in question,or move the subroutine definition ahead of the call to get proper prototype checking. Alternatively,if you are certain that you’re calling the function correctly,you may put an ampersand before the name to avoid the warning. See perlsub.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读