Perl 5 operator list

schwern on 2005-05-17T03:35:59

I stumbed across some guy's blog using the Periodic Table of Perl 6 Operators as evidence that Perl 6 is too complicated. I've seen this sort of thing a lot with regard to Perl 6. I suspect that its just the fact that nobody's ever tried to actually lay out Perl's operator table before and he's in shock seeing it for the first time. I highly suspect Perl 5's would be much, much worse. So I decided to find out.

Perl 6 (according to the Table) has 18 levels of precedence... with some cheats. Perl 5 (according to perlop) has 24... not counting the cheats. And I suspect 24 isn't even quite truthful.

I then counted up all of Perl 5's operators using the same standard as for the Perl 6 table. Pretty much everything that matches /\W/ which isn't syntax, plus a few word ops (and, not...), some op-like things (ref, defined...) and some ops we traditionally think of as functions (-r, -w...). The point was to produce something similar in spirit to the Perl 6 Table for comparison. I haven't produced the table but I have created a big list of all Perl 5 ops. 128. The Perl 6 Table weighs in at 180 (153 if you remove all the bitwise munching ops). Figuing out Perl 5's precedence should be, umm... interesting.