in reply to Re^2: Reading Text Lines
in thread Reading Text Lines

if$.%100==0 is shorter and clearer than unless$.%100

I believe it's a matter of taste. My (maybe weird) way of thinking is that I'm interested in $a % $b when the modulo operator yields a false value, in the same way that I'm interested in $a == $b when the result is true. So, the alternatives are:

if $a % $b == 0 if !($a % $b) if not $a % $b unless $a % $b

To me, the clearest of them is the last one. Maybe it's because I use it regularly. Note that the one you said was shorter and clearer is the longest of that four, once we beautify the code.

--
David Serrano

Replies are listed 'Best First'.
Re^4: Reading Text Lines
by ikegami (Patriarch) on May 11, 2006 at 19:45 UTC

    Negation where it is not needed, the treatment of a numerical formula as boolean and especially their conjunction may not be confusing to you, but it is confusing to many with whom I've worked.

    "once we beautify" doesn't count when golfing. That's what the poster of the parent to my reply appeared to have been doing.

Re^4: Reading Text Lines
by rodion (Chaplain) on May 11, 2006 at 22:12 UTC
    "unless $a % %b" is also clearer to me, but it is not clearer to my colleques, nor to others (according to "Perl Best Practices"). I've found I've had to give up a number of my math-major tendencies so that my collegues can clearly see what's going on in the code I write. It's not always easy to do that.