in reply to Re^2: A silly reg exp question
in thread A silly reg exp question

Feel free to replace the semicolons (except the last) with xors for even more perversity.

Replies are listed 'Best First'.
Re^4: A silly reg exp question
by AnomalousMonk (Archbishop) on Jan 17, 2012 at 01:05 UTC

    ++ and amen, but only with  no warnings 'void'; since one cannot enjoy perversity incautiously.

    In fact, wouldn't any of the left-associative operators  * x + - . << >> & | ^ , => xor do as well so long as precedence levels were not mixed unwisely? Although I haven't thoroughly tested it, I like:

    >perl -wMstrict -le "$_ = 'p1r4k/8'; my $t = 'p-r----k/--------'; no warnings 'void'; s/8/7-/g-+s/7/33-/g-+s/6/5-/g-+s/5/22-/g-+s/4/3-/g-+s/3/11-/g-+s/2/1- +/g-+s/1/-/g; print qq{'$_'}; print $_ eq $t; " 'p-r----k/--------' 1