4 ms·
When I want either addition or string concatenation, I know it, I can't think of a use case where I'm happy getting either randomly. Perl got this right: 2 +
by erik_seaberg 6y ago
When I want either addition or string concatenation, I know it, I can't think of a use case where I'm happy getting either randomly. Perl got this right:
2 + 2 == 4
2 . 2 eq 22
You can even declare that failed conversions should throw:
use warnings FATAL => qw(numeric)
- sergeykish 6y agoYes, perl is consistent perl print "2" + 1 3 print "2" - 1 1 js > "2" + 1 "21" > "2" - 1 1
- weare138 6y agoAnother thing I thought was clever about Perl is it has two comparison operators, '==' for numeric values and 'eq' for strings.