yes, readability at first is a problem with Mr. Ternary... i can't get wrong with that... but as often you use the ternary operator becomes handy. but wait my delima was this "\&". what was that execption for in the strict pragma?

I think it is your dilemma, and yes: I had never seen it. Indeed, had you asked me, I would have guessed it was no valid syntax at all. And while I'm far from being a guru myself, I've seen quite a lot of code over the years, from gurus too. However reasoning on it a little, it's easy to see it simply amounts to taking a real reference after taking a symbolic dereference. The exception perldoc strict talks about is that that particular symbolic dereference, in that situation, doesn't issue an error, while it would in all the other situations:

C:\temp>perl -wMstrict -e "\&{'foo'}" Useless use of reference constructor in void context at -e line 1. C:\temp>perl -wMstrict -e "&{'foo'}" Can't use string ("foo") as a subroutine ref while "strict refs" in us +e at -e line 1.

Why you think you can use that instead of eval is completely out of my comprehension. The semantics is completely different.


In reply to Re^3: Mr. Ternary is greater than Mrs. If Else by blazar
in thread Mr. Ternary is greater than Mrs. If Else by PerlPhi

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.