Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
> If there's only one value in the return list, how can I return that value in scalar context, not the count of 1?
just return the list! In scalar context the last element is taken, so if you are only returning "one value in the return list" thats the same. It's the scalar of an array(!) which counts.
UPDATEok not that easy, avoid scalar context and explicitly put the scalar into a list at LHS.
Though we asked several times you haven't clarified which result you expect in in case of scalar context and longer list!
Cheers Rolf ( addicted to the Perl Programming Language) In reply to Re^3: wantarray alternative
by LanX
|
|