in reply to Re: Re: binary ids
in thread binary ids
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: binary ids
by tachyon (Chancellor) on Feb 10, 2003 at 21:22 UTC |