Usually, when there is a choice like that, Perl supports the latter but prints a warning under -w
I'll second that notion. The interpreter should be fixed to implement this idea and the documentation should be changed to something like...
If the last thing (Note 1) in a subroutine is an expression, then the return value of the subroutine is the value of that expression. Otherwise if the last thing in a subroutine is a statement (if, for, while, etc.) and the subroutine is called in non-void context, then issue a warning. Alternatively, 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...
Note 1: We should another word besides "thing" but I'm not sure what that is.
| [reply] |