Your snippet doesn't prove that, but -MO=Concise does.

Damn it! You stole my proof of proof :) I have exactly that on my terminal all ready to c&p.

But the list operator doesn't return a list in scalar context.

I never said it did?

No reduction occurs, default or otherwise.

If I code:

sub x{ wantarray ? 'fred' : @_[ 0 .. $#_ ]; } print x( 1, 2, 3 );; fred print scalar( x( 1, 2, 3 ) );; 3

The list I supplied to x() and attempted to return, appears reduced,; is less (different) than it was; is no longer that same list. That's all I meant by "default reduction".

Ie. the thing that happens when a construct that would, in a list context, produce a 'list', appears in a scalar context.

Now, if you can find a better term for that than "list in a scalar context", enlighten away!

Actually, I think that thing, that I tried to avoid controversy by terming "reduction", can actually be seen happening:

if (GIMME != G_ARRAY) { if (++MARK <= SP) *MARK = *SP;

I'd read that (with licence) as: if we're not in an G_ARRAY context, if there are more than one items on the stack, then throw away all but the last item.

It's the builtin or operator that makes the choice, not the context.

The builtin or operator? Where? I don't see no or operators?


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."

In reply to Re^9: Scalar context of slice (myth) by BrowserUk
in thread Scalar context of slice by thenaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.