- 论坛徽章:
- 6
|
lz你要明白函数的返回值是什么,如果函数里面没有return,是返回最后一行作为返回值
注释掉print时,return $i=120,
没注释print时,reurn (print xxxx),是scalar,值为1
The return value of the subroutine (or of any other block, for that matter) is the
value of the last expression evaluated. Or, you may use an explicit return state-
ment to specify the return value and exit the subroutine from any point in the
subroutine. Either way, as the subroutine is called in a scalar or list context, so
also is the final expression of the routine evaluated in that same scalar or list
context
回复 1# yxmingliang
|
|