As has been pointed out, it's a binary operator (...)

I know it is a binary operator, and I personally do know how to handle that...  I'm just saying that it might be more intuitive if it would default to a (more DWIM) list context interpretation instead... (I bet this very problem is going to be a recurring issue here at PM).

I so far haven't seen a convincing argument why it couldn't - in theory - behave that way ("not breaking orthogonality" is not sufficiently convincing, IMHO). A lot in Perl is concerned with making code do what people expect. And after all, there are other builtins, and at least one operator that can deal with lists just fine (think of (1, 2, 3) x 5).

Sure, changing things will create conflicts with respect to the currently documented behaviour, but I wonder if it's primarily those scalar context variants that people will be thinking of using the smart match operator for, or if it's more the particularly neat implicit iteration behaviour that people will predominantly be wanting to use this operator for. In the latter case, it would be more natural if it could deal with lists without any special ado...  Just my five cents.

(Ultimately, what's intuitive and what isn't is mostly an empirical or statistical question, so maybe we should have a PM poll on that?)


In reply to Re^3: 5.10 smart match behaviour by almut
in thread 5.10 smart match behaviour by zgrim

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.