函数声明"sub function($$)"的作用是什么?意思是? [英] What does the function declaration "sub function($$)" mean?

查看:133
本文介绍了函数声明"sub function($$)"的作用是什么?意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Perl一段时间了,但是今天我遇到了这段代码:

I have been using Perl for some time, but today I came across this code:

sub function1($$)
{
   //snip
}

这在Perl中是什么意思?

What does this mean in Perl?

推荐答案

它是具有 prototype 需要两个标量参数.

It is a function with a prototype that takes two scalar arguments.

有很多强烈的理由认为通常不实际使用Perl原型-如以下注释中所述.最有力的论据可能是:

There are strong arguments for not actually using Perl prototypes in general - as noted in the comments below. The strongest argument is probably:

从2008年开始有关于StackOverflow的讨论:

There's a discussion on StackOverflow from 2008:

MooseX :: Method :: Signatures 中有可能替换 a>模块.

There's a possible replacement in the MooseX::Method::Signatures module.

这篇关于函数声明"sub function($$)"的作用是什么?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆