Thanks everyone for your feedback/hints. Yes, had I simply added the -w warnings switch I would have gotten feedback from the perl interpreter directly. I guess I was so brain-locked by such a simple problem that I assumed that warnings (and perltidy) wouldn't offer more insight. My mistake.

At this point I guess I would humbly state my opinion that in this instance there perl interpreter has gone beyond TIMTOWTDI to "Thats just plain wrong" (just my opinion).

In my mind, order-of-operation precedence is implicitly bounded by the end-of-statement semi-colon ';'. If a function (like print) takes an argument of LIST, it should greedily operate on all list elements up to the end of the statement indicated by the ';'.

So, "print (LIST),LIST;" should just do "print (LIST,LIST);". I understand that using parens as function argument delimiters is optional, and that inconsistent use of parens with functions leads to ambiguous dilemmas, but if someone really wanted to execute the second list in "function (LIST),LIST;", then they should have not used comma ',' as a statement separator, they should have use a semi-colon as "function (LIST);LIST;".

In my mind, the semi-colon is a statement separator, and the comma is a LIST argument separator. When perl interprets "function (LIST),LIST;" as "function (LIST);LIST;", it is implicitly treating (and converting) the comma into a statement separator.

I really like perl, but in this one instance I think the behaviour is wrong. I am sure that Larry and some other developers have had some philosophical discussions about this example, and if anyone can dig them up I would be happy to read them.

Thanks,


In reply to Re^2: print list, comma not working? by fzellinger
in thread print list, comma not working? by fzellinger

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.