From: Xavier Noria Date: Fri, 21 Oct 2005 08:43:12 +0000 (+0200) Subject: Re: [PATCH] return values reworded in perlsub.pod X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbb128be9d98f2152d3ce957d4c3c518a9f86260;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] return values reworded in perlsub.pod Message-Id: <1C8D7C5C-986C-4336-8C4F-8B965CE1AD17@hashref.com> (with minor tweaks) p4raw-id: //depot/perl@25812 --- diff --git a/pod/perlsub.pod b/pod/perlsub.pod index fbf27cd..9711ca6 100644 --- a/pod/perlsub.pod +++ b/pod/perlsub.pod @@ -73,16 +73,19 @@ Assigning to the whole array C<@_> removes that aliasing, and does not update any arguments. X X X<@_> -The return value of a subroutine is the value of the last expression -evaluated by that sub, or the empty list in the case of an empty sub. -More explicitly, a C 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. +A C statement may be used to exit a 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. + +If no C is found and if the last statement is an expression, its +value is returned. Otherwise, if the last statement is a control structure +like a C, the returned value is unspecified. The empty sub +returns the empty list. X X X Perl does not have named formal parameters. In practice all you