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

查看:32
本文介绍了函数声明“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 模块.

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

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