in reply to Why are hex numbers inside strings extrapolating to numbers (incorrectly)?
I also did run the tests under some configurations, and was able to reproduce some results :
I'm not sure what the issue with the test from the command line is, because here I use wrong double quotes which could be messed with by the shell (bash). I can confirm the other results with ActivePerl 5.005 build 517 (yes, I'm running that ancient version here), and the weird quotes trick also works under cmd.exe and NT :Linux x86 box : corion@samson > perl -v This is perl, version 5.005_02 built for i586-linux blah blah corion@samson >perl -w test.pl Argument "0x1" isn't numeric in add at test.pl line 4. 01: 1 Argument "0x2" isn't numeric in add at test.pl line 4. 02: 1 Argument "0x3" isn't numeric in add at test.pl line 4. 03: 1.5 Argument "0x4" isn't numeric in add at test.pl line 4. 04: 1 ... etc ... corion@samson:~ > perl -e "print "0x30"+0;" 48corion@samson:~ >
Whatever this means, but maybe some perl luminary can enlighten us.F:\>perl -e "print "0x30"+0;" 48
Update :Under Win32, ActivePerl build 517, the script works as expected, printing 0 for each number.
|
|---|