this post was submitted on 04 Jun 2025
1015 points (98.6% liked)
Programmer Humor
23855 readers
1280 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
That's because Perl doesn't do operator overloading in general. Even the equality operator is different for strings (
eq
instead of==
). As a language, it may look pretty weird and lack some modern features, but the underlying design is surprisingly intelligent and consistent in many ways.Not strictly true.
Perl's default bitwise operators do differentiate between numbers and strings that look like numbers in a way that addition doesn't*, and the readline/glob operator
<>
does different things depending on what (if anything) is between the signs.There's also the whole
overload
pragma for objects, which doesn't affect default data types, but if you're sufficiently perverse, you can define a String class that uses '+' like JavaScript.* in 2015, they added new operators so that those and the original operators don't overload and have only one specific purpose if the
bitwise
~~pragma~~ Edit: feature is turned on. You might know all this already though.