in reply to Pre-increment *and* Post-increment

I was thinking about that this week, because I wanted (for no good reason), things like:

$n+++; # increment, then do that again (add 2) $n++++; # increment, then again, and once more (add 3) $n++++++++++; # increment N-1 times, just because I can --$n++; # use the value that's one less, then restore it ++$n--; # same thing, other way $n++-; # increment, but not really cause this is a JAPH $n++-+; # I changed my mind, really do it this time $n++-+-; # boss says change it back $n+- # can I decide later, or, pick one at random $n** # no exponent, so square $n $n*** # cube it, and so on $n***/ # square it, but cube it first and go back one $n// # 1 $n/// # 1/$n $n///** # $n
Surely Perl can be even more write-only if we just applied ourselves.
--
brian d foy <bdfoy@cpan.org>

Replies are listed 'Best First'.
Re^2: Pre-increment *and* Post-increment
by Anonymous Monk on Feb 01, 2005 at 23:20 UTC
    and that would be horribly annoying. Instead of  $n += 5; people would write $n++++++... does that seem pretty? On the other hand, it wouldn't be all that hard to write a source filter to do this...
Re^2: Pre-increment *and* Post-increment
by ambrus (Abbot) on Feb 03, 2005 at 20:57 UTC

    If you want +++ operator, rather use them for addition with lower precedence, for example this

    $a + $b ** $c + $d ++ $e + $f ** $g + $h *** $i + $j ** $k + $l ++ $m + $n ** $o + $p
    would become
    (($a + $b) * ($c + $d) + ($e + $f) * ($g + $h)) * (($i + $j) * ($k + $l) + ($m + $n) * ($o + $p))