3 ms·
So how do I know if "1" gets added to a 0 or to an empty string?
by thomasahle 11y ago
So how do I know if "1" gets added to a 0 or to an empty string?
- mapleoin 11y agoI suppose there's some type inference there and you'll get the default be 0 since 1 is also an integer, not a string.
- colonelguy 11y agoPerl uses separate operators for mathematical addition and string concatenation. 1 + 1 == 2; 1 . 1 eq 11; It uses separate operators for most mathematical and string operations, for that matter. There isn't much of a meaningful difference between strings and numbers in Perl -- it converts between then depending on the operation.