Jan 21, 2015, 6:13 AM
Post #19 of 25
Your doubt about what is returned by the sub is a perfect example why reading the related documentation is very important.
Re: [Tejas] How to copy files to windows share using perl
[In reply to]
4th & 5th paragraphs:
A "return" 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 "return" is found and if the last statement is an expression, its
value is returned. If the last statement is a loop control structure
like a "foreach" or a "while", the returned value is unspecified. The
empty sub returns the empty list.
(This post was edited by FishMonger on Jan 21, 2015, 6:13 AM)