in reply to Re: Equality operatorsin thread Equality operators
When converting strings to numbers, Perl only looks at the start of the string. '1foo' becomes 1 and 'foo1' becomes 0.
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
Others have already explained how the conversion works, but if you want to see for yourself the number into which a string is coerced, add 0 to the string.
print(0+'a', "\n"); # 0
print(0+'b', "\n"); # 0
print(0+'1', "\n"); # 1
print(0+'2', "\n"); # 2
print(0+'1foo', "\n"); # 1
print(0+'foo1', "\n"); # 0
.desrever si txet eritne ehT
.backwards are (letters the not but) words the Only
ehT sdrow era ni redro, tub eht srettel era eht rehto yaw.
Who ndees baacdkrws wehn you have Tceilmopgyya?
?wdors reeersvd up meixd about How
.tusnnmihep rof nuttolg a m'I
Results (441 votes). Check out past polls.