in reply to Re^3: Does @{ } copy arrays?
in thread Does @{ } copy arrays?

@a in scalar context just pushes its size onto the stack. $#a in scalar context could be an lvalue or an rvalue, so a 'magic' var is pushed onto the stack that updates the array's size if assigned to. This could probably be optimised when pp_av2arylen is called in rvalue context.

Dave.

Replies are listed 'Best First'.
Re^5: Does @{ } copy arrays?
by QM (Parson) on Oct 17, 2009 at 19:57 UTC
    Ah, of course. I suppose there are cases where it's not immediately apparent to the parser if a given occurrence is an lvalue or rvalue?

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re^5: Does @{ } copy arrays?
by ikegami (Patriarch) on Oct 28, 2009 at 18:00 UTC

    This could probably be optimised when pp_av2arylen is called in rvalue context.

    Done by commits 02d85cc37a4acecafdc2f0b45640b03cd1f4ac71 and 28c5b5bcd7f52e6b2219508a1066cd0ccc8dd19a. You'll see these changes in 5.11.2 (next month's dev release) and 5.12 (early to mid 2010)