in reply to Returning Values from Subroutines
The return value of a subroutine is the value of the last expression evaluated. More explicitly, a "return" statement may be used to exit the subroutine, optionally specifying the returned value, which will be evaluated in the appropriate context (list, scalar, or void) depending on the context of the subroutine 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.
So yes, the way you show is one way to do it. err ... but return $result.
-derby
|
|---|