- 論壇徽章:
- 6
|
lz你要明白函數(shù)的返回值是什么,如果函數(shù)里面沒有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
回復(fù) 1# yxmingliang
|
|