- 论坛徽章:
- 0
|
- A "return" statement may be used to exit a subroutine, optionally specifying the returned value, which
- will be evaluated in the appropriate context (list, scalar, or void) depending on the context of the sub-
- routine call. If you specify no return value, the subroutine returns an empty list in list context, the
- undefined value in scalar context, or nothing in void context. If you return one or more aggregates
- (arrays and hashes), these will be flattened together into one large indistinguishable list.
复制代码 因为函数返回的是什么决定于调用该函数的环境。也就是说:
用$aa=$fun()的时候,这个是标量环境,那么函数返回的是数组或者列表处于标量环境的值,而不是返回这整个数组,或列表,然后再求值。 |
|