This is misleadingly incorrect. You assume that just because the perl compiler will read a plain 0x0005 as the numeric value 5 that the same thing in a scalar behaves the same way. In this case strings with leading numbers are evaluated in numeric context as the value of the leading number. In this case this means that $var = "0x0005"; $var == 5 is false - in fact, $var == 0 because $var begins with the string "0".
The correct answer is to use the hex() function. You'd have to resort to using eval to get your idea to work (which re-invokes the compiler which has its own rules...).
Seeking Green geeks in Minnesota
In reply to Re^3: binary ids
by diotalevi
in thread binary ids
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |