The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think the wantarray solution is fine, and not all that awkward. That's what wantarray is for. I think I can make a case for scalar foo LIST to return the last element of the result return wantarray ? @arr : $arr[-1]; instead of the first. A comma sequence behaves that way in scalar context, so that is the ordinary precedent competing with array count for behavior in scalar context. A third possibility is to return a reference to the generated array. Some modules do that, but it is clearly not desired here. No, I don't think you missed anything. After Compline, In reply to Re: Context aware functions - best practices?
by Zaxo
|
|