Hacker News new | ask | show | jobs
by kanatohodets 3850 days ago
Perl has distinct operators for string concatenation and numeric addition (as well as string comparison/numeric comparison):

  $ perl -E 'say "plus: ", 1 + "1"'
  plus: 2
  $ perl -E 'say "concat: ", 1 . "1"'
  concat: 11
There is some type funkiness: a Perl variable can have both string and numeric components. However, which one is in use is only a problem in serializers (JSON, etc.) -- in normal usage you can rely on choosing the right operator for the type at hand.