Expand/Shrink

Perl/Raku operators

In Perl, anything is a one-liner if you know the magic operator (the original from five years earlier can still be seen here) - an amusing "periodic table" of the Perl/Raku operators, their precedence levels and, well, judge for yourself.

One of the great things about Perl is it can be quite slow, but they rather improved on that in Raku, and made it really slow!
One of the great things about APL was too many weird and cryptic operators, but they rather improved on that in Raku...

More than once I have fretted that Phix does not (for instance) have an infix exponentiation operator, but relies on the power() function, and just as often found evidence of people struggling with the subtle differences of an infix form, especially between various different programming languages, eg is -5^2 the same as (-5)^2 or -(5^2)? Trust me, it is [consistent within each programming language but overall] pretty much 50:50, aka utterly random, whereas of course and in contrast there can be absolutely no doubt whatsoever about the exact meaning of either power(-5,2) or -power(5,2).

Of course Raku, being Raku, the <ahem> "programming language" formerly known as Perl 6 (RIP Prince), allows you to override the precedence of any operator (essentially by re-implementing it) and therefore any component can willfully introduce subtle and nearly impossible to track and trace bugs into any other part of the application. The same can be said for Ruby. Code that works perfectly in one application simply won’t work in another. Neat.

The argument that no sane programmer would ever do that does not convince me: I have seen the internet.

Ermmm... Hang on a minute... OK sunshine, if no-one is ever going to use it...