Not, not really. A list isn't a Perl data structure, but an array is. A list is just a bunch of stuff. The way we work with "stuff" in Perl is to use the "comma operator" (and its cousin, '=>'). The comma operator is one of those things that no-one (who isn't on p5p) thinks about and expects to just DWIM. But, it's the way that arrays and lists interacting possible.

Think about it this way - a list is some stuff collected together, but an array is a place in memory with all sorts of magic associated with it. This means that you can take an array and do useful operations on it, but you cannot do that with a list. However, there is no such thing as "array context" - it's "list context".

The reason why most people confuse the two (and why they're usually interchangeable) is that an array will (usually) impose list context around it, if it's an lvalue. (Also, there's the deplorably-named wantarray, which actually checks for list context and has nothing to do with arrays.)

At this point, you've exhausted my knowledge. If you want more, I suggest reading the relevant portions of the Camel book. I did so at one point, thought it was neat, then promptly forgot it cause it's never once been relevant to me in my years of Perl development. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re3: Unexpected variable assignment by dragonchild
in thread Unexpected variable assignment by simon.proctor

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.