in reply to Re: What should be returned in scalar context? (best practice)
in thread What should be returned in scalar context?
The right "default" behavior, in my opinion, is to return @ret; and let the programmer using your function sort it out. Document that your function returns an array and be done with it.
No, please don't!
Document that it returns a list. It's not possible to return an array. It is possible to return an array reference, but this code is not doing that. If you document that some functions returns an array, the user can only guess: is it a list or an array reference?
Document that your function returns a list and be done with it.