in reply to Re^8: Scalar context of slice ("list")
in thread Scalar context of slice

What does your logic make of this?

@a = 'a'..'b'; print $z = @a[0,1] = @a[ 1, 0 ];; 2

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^10: Scalar context of slice ("list")
by ikegami (Patriarch) on Oct 04, 2008 at 11:35 UTC

    Function of operators in question:

    • Slice in list context returns the specified elements.
    • Slice in scalar context returns the last of the specified element.
    • List assignment in list context returns its LHS.
    • List assignment in scalar context returns the number of elements assigned.
    • Scalar assignment in any context returns its LHS.

    Applying precedence and associativity, we get:

    1. Right-most slice (in list context) returns the specified elements.
    2. Left-most slice (in list context) returns the specified elements.
    3. List assignment (in scalar context) returns the number of elements assigned.
    4. Scalar assignment (in list context) returns its LHS.