On Wed, Jan 10, 2001 at 09:36:51PM -0800, Stephen McCamant wrote: > --- perl-current/pod/perldiag.pod Thu Dec 28 17:35:12 2000 > +++ perl+lval2/pod/perldiag.pod Wed Jan 10 21:12:45 2001 > @@ -929,6 +929,14 @@ > temporary or readonly values) from a subroutine used as an lvalue. This > is not allowed. > > +=item Can't return %s to lvalue scalar context > + > +(F) You tried to return a complete array or hash from an lvalue subroutine, > +but you called the subroutine in a way that made Perl think you meant > +to return only one value. You probably meant to write parentheses around > +the call to the subroutine, which tell Perl that the call should be in > +list context. But (sub_returning_lvalue_hash()) = 1; would be rather odd and, I hope, generate an 'odd number of elements in hash assignment' error. And (sub_returning_lvalue_array()) = 1; could perhaps be better written as sub_returning_lvalue_array() = (1); (I'm not sure if that'll work as I'd expect, I've not been following too closely.) So I'd suggest that the docs suggest writing parentheses around the _value_ rather than the call. Tim.Thread Previous | Thread Next