in reply to Strange character arithemtic
Regarding question 3: Perl does its level best to convert a string to a number in numeric context, as supplied by the addition (not assignment) operator. Example of behavior in this context (with warnings, which you obviously wern't using):
>perl -wMstrict -le "for my $string (qw(x 1x 12x 987x)) { print qq{string '$string' in numeric context is == }, 0+$string; } " Argument "x" isn't numeric in addition (+) at -e line 1. string 'x' in numeric context is == 0 Argument "1x" isn't numeric in addition (+) at -e line 1. string '1x' in numeric context is == 1 Argument "12x" isn't numeric in addition (+) at -e line 1. string '12x' in numeric context is == 12 Argument "987x" isn't numeric in addition (+) at -e line 1. string '987x' in numeric context is == 987
See Scalar values in perldata.
|
|---|