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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |