Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
The comma is still constructing a list, that simply has nowhere to go. Since the list is constructed left to right, the right-most element ends up being assigned to $a.


It would appear that I'm incorrect in asserting that the thing on the right side of an equation that looks like this:

$a = (1, 2, 3, 4);

could be construed as being a list. And even more incorrect in saying that it is in scalar context.

While I don't understand how it isn't a list (it's contained in (), it has commas, and it represents multiple values), I do understand that whatever term we can use to describe the Rvalue entity, we cannot say that it is a list in scalar context. This, to my understanding after reading merlyn's discussion threads is because a list is a list is a list, and scalars are scalars are scalars. The only possibly accurate description for the above code example, that I can come up with having read merlyn's words, are that it is the list is passing its rightmost element through the assignment operator ( = ) which is, itself, in scalar context. The entity on the right still looks like a list to me, but it is apparently accurate to assert that the comma operator knows whether the items it is affecting are being passed to a scalar or to an array. My prior supposition was that the assignment operator ( = ) was the one who understood things like context.

I am nevertheless curious to see the internal representation of a statement such as the one above; not the 'perl -MO=Deparse' one, but still lower level, so that I can better understand the nature of such a statement. I can accept at face value the descriptions I've received from the Gods and Saints, but it is still appropriate to understand the internal character of ones' faith.


"If I had my life to do over again, I'd be a plumber." -- Albert Einstein

In reply to Re: Re: dot '.', comma ',' operators "oops" & "huh?" by davido
in thread dot '.', comma ',' operators "oops" & "huh?" by chunlou

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [erix]: I guess I'll stare it down in the end but I'm already staring for a while... :)
    [erix]: btw, I had a typo in there, so reload (if anyone is looking)

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (8)
    As of 2018-01-19 08:15 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (216 votes). Check out past polls.