|Keep It Simple, Stupid|
Re: new way to code html?by ColonelPanic (Friar)
|on Nov 21, 2012 at 14:29 UTC||Need Help??|
It took me forever to figure it out, but here is what is happening with your code. The ternary operator ( - ? - : - ) is not being interpreted as you think it is. If you add parentheses, the behavior goes away:
Instead, what you wrote is being interpreted as this:
That's right, in Perl you can assign to a ternary operator expression! This "feature" allows you to assign to one of two different variables based on a conditional.
So, what is happening?
The result: some truly bizarre behavior. It would make a great trick for some obfuscated code. Barring that, you should never, ever, ever (ever!) do it again.
I do intend to ++ your post, though, because this was really fun.
When's the last time you used duct tape on a duct? --Larry Wall