Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Mini-Tutorial: Scalar vs List Assignment Operator

by JavaFan (Canon)
on Aug 20, 2009 at 16:39 UTC ( [id://790137]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://790137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2025-11-19 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.