That probably would make for a better metric. Also, only counting those uses of the ternary where there are only 2 not 3 operands in play would also improve it; But I can't work out how to write the regex for that:)

I take your point though, these operators probably wouldn't be use that often.

Then again, how often have you ever used the ... version of the flip-flop operator? Other than when I was trying to understand it and find uses for it, I've never used it in anger, but I wouldn't exclude it from the language unless it caused the compiler or the interpreter some level of penalty on code that didn't use it. YMMV, and maybe there isn't enough reason to add something which is obviously more work than just leaving something that is already there.

Oh well. T'was just a thought:) Though it is a recurring one going back many years to other languages that have the ternary op. Perl has resolved so many of the annoyances of syntax that bugged me in C and Java, that this seemed like another candidate.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

In reply to Re: Re: Re: Re: A set of new operators. In keeping with the design of Perl? by BrowserUk
in thread A set of new operators. In keeping with the design of Perl? by BrowserUk

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.