http://www.perlmonks.org?node_id=790137


in reply to Mini-Tutorial: Scalar vs List Assignment Operator

Beside my (...) there are also our (...) and local (...) that generate list context. sub (...) with sub an lvalue subroutine doesn't generate list context.

Replies are listed 'Best First'.
Re^2: Mini-Tutorial: Scalar vs List Assignment Operator
by ikegami (Patriarch) on Aug 20, 2009 at 17:12 UTC

    Thanks. Fixed.

    Yes, there's nothing special about lvalue subs. f() doesn't cause the list assignment operator to be used, but (f()) does.

    $ perl -wle'sub f :lvalue { $x,$y } f()=(4,5); print $x,$y' Useless use of a constant in void context at -e line 1. Use of uninitialized value in print at -e line 1. 5 $ perl -wle'sub f :lvalue { $x,$y } (f())=(4,5); print $x,$y' 45