Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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.

UPDATE:

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.

Dave

"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

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2014-12-20 19:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (97 votes), past polls