Perl Monk, Perl Meditation | |
PerlMonks |
Re: Ternary Operator: Condition-Negationby theorbtwo (Prior) |
on Aug 28, 2002 at 09:15 UTC ( [id://193394]=note: print w/replies, xml ) | Need Help?? |
You have indeed, as dws explained so well. A nice tool for situations like these, where you suspect perl might parse your code differently then you want it to, is B::Deparse, which shows you exactly what perl thinks your code is saying. In this case, using it looks somthing like this:
In this case, I want perl to try to compile without running (-c), using the O module (the compiler-front end; for technical reasons (read: reasons I don't recall) Deparse is considered a compiler), passing it the Deparse (tells it to use B::Deparse, and pass it the rest as parameters), and -p (tells deparse to give me lots of parenthesies). For more info on using B::Deparse, follow any of those links; there's also options to not munge various things to give you a look that's closer to perl's, but harder to read. Deparse is very useful for deobfuscating obfuscations, both intentional and otherwise. Oh, and it's core in 5.6 and later, IIRC. (For some reason, the CPAN results disagree with me, and say 5.8, which can't be right, since I have it and am on 5.6. Strange...) Confession: It does an Immortal Body good.
In Section
Seekers of Perl Wisdom
|
|