in reply to Debugging Regexes

Personally, I think that the way you wrote that statement is evil and such constructs should be avoided. I really shouldn't have to think too hard about operator evaluation order to figure out how your code works. You could have at least put parentheses around the operands of the &&. As the code presently exists, I'd have to run it through a debugger to convince myself that it works the way you claim it works.

Maybe this is an extreme opinion, but I think I'd prefer that compilers/interpreters forced you to parenthesize for stuff like that, and threw ambiguity errors when you didn't.

Replies are listed 'Best First'.
Re^2: Debugging Regexes
by Jasper (Chaplain) on Jun 29, 2004 at 16:18 UTC
    yer.. the OP should have used something like:
     print /foo/ ? 'bar' : 'baz'
    IMO