perl 调用方法 子例程说明

31 篇文章 30 订阅 ¥39.90 ¥99.00
Perl没有专门的类定义语法,一个包是包含变量和子程序的命名空间。在类中,子程序通常期望对象引用或类名作为第一个参数。方法实际上就是常规的子程序,使用'sub'声明,并期望接收对象或类名作为第一个参数。Perl提供了->运算符进行方法调用,大多数方法都期望操作对象。
摘要由CSDN通过智能技术生成
Perl does not provide any special syntax for class definitions

Perl 不提供任何特殊的语法对于类的定义

A package is simply a namespace containing variables and subroutines. The only difference is that in a class, the 

subroutines may expect a reference to an object or the name of a class as the first argument. This is purely a 

matter of convention, so a class may contain both methods and subroutines which don't operate on an object or 

class.

一个包是一个简单的名字空间包含变量和子程序。唯一的区别是在一个class里,

子程序可能被期望一个引用到一个对象或者 类的名字作为第一个参数

这是一个纯粹的惯例,因此一个class可能包含方法和子程序  不操作在对象或者类上。


l does not provide any special syntax for defining a method. A method is simply a regular subroutine, and is 

declared with sub. What makes a method special is that it expects to receive either an object or a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

scan724

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值