Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I would say that a list in Perl is any grouping of scalars (including groupings of zero or one scalar) on the stack.

Then ($a,$b,$c) isn't a list. It might produce a "list" (using your definition), if used in a list context.

I certainly consider ($a,$b,$c) a list. It is a list of scalar expressions which has everything to do with the syntax of the construct and nothing to do with some Perl data structure which certainly exists (in multiple forms) but that people keep wanting to say is the one true meaning of "list" when dealing with Perl.

"List" can mean a list of scalars in memory, much like a Perl array, but it can also mean many other things. I find people repeatedly getting into trouble due to attempts to nail down the definition of a "Perl list".

There is no one definition of a "Perl list".

Update: and the reason this leads to trouble is that even if we restrict ourselves to the standard documentation that comes with Perl, the word "list" is used to mean many different things in that documentation. Sometimes the word "list" is used to mean different things by the same author in the same paragraph. So if you have a "nailed down" meaning for "list", some part of the Perl documentation will tell you wrong things (like that tr takes a list of scalars).

Note that I don't think we should "fix" this by only using "list" to mean only one thing in the Perl documentation. I'd hate to see the ton of "Oops, I wrote 'list' but that wasn't a Perl List(tm) I was talking about so I'll have to call that a... uh.. 'set'... no, hmm... 'collection', uh, 'tuple'. Yes 'tuple'!"

        - tye (but my friends call me "Tye")

In reply to (tye)Re2: tr doesn't *really* use a list by tye
in thread tr doesn't *really* use a list by Boldra

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
    and the questions are moot...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (3)
    As of 2018-02-25 13:35 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (312 votes). Check out past polls.