'Some people say a ... is a value.' => 'l'
'Some people say a ... is a variable.' => 'a'

Badly formed question (based on weak source text). Any answer is correct because the very fact of answering the question means at least one person says it.

'You put things into ... context.' => 'l'

s/put things into/evaluate expressions in/

Expressions are evaluated in a context, not put into a context. For example, the expression "@array" evaluates to something based on context. It doesn't evaluate to something that's put into scalar context. (What would that something be? Can't be a list, cause there's no such thing as a list in scalar context.)

perlsub uses the correct terminology.

'You initialize a ... with a list.' => 'a'

You can also initialize a list with a list.

'You initialize an array with a ... ' => 'l'

In theory, I find perfectly acceptable to read "@a=@b" as "initializing array @a with array @b", so both answers would be acceptable to me.

In practice, the implementation of aassign would determine whether you can assign an array to an array.

'You "foreach()" across a ... ' => 'l'

In theory, that is the view that's presented.

In practice, not necessarily. There are many different for loops. Some don't create a list (such as for (x..y) and for (@array)), and one iterates over an array (for (@array)).

Note that you used the practical answer earlier and the theoretical answer here, which just adds to the confusion.

'A ... in scalar context behaves like the number of elements in it.' => 'a'

s/behaves like/evaluates to/, like above.


In reply to Re: Lists and Arrays and Boredom by ikegami
in thread Lists and Arrays and Boredom by carol

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.