How do the caller tell if S returned a scalar or an array?I presume you mean list where you wrote array.
The answer is, it's actually not up to S. If S is called in scalar context, a scalar is returned. If S is called in list context, a list is returned. If S is called in void context (a special case of scalar context), nothing is returned.
In reply to Re: Detecting type of output from subs
by JavaFan
in thread Detecting type of output from subs
by mogul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |