I am tryin to write a piece of code that will take two values, add them together and print them out. Ah, simple you might think. But, I want to take my input as raw unsigned binary and perform the arithmetic on it. The problem that I am having is that perl is being too clever!
Say for example I enter 2 parameters as '1' and '2' (ascii codes 0x31 and 0x32 hex) and put them into two scalars. I add the scalars together `$a + $b`. I want the result of the sum of the two scalars to be returned as 0x61 hex, *not* '3'.
In summary, I want to prevent any interperation of data within scalars and to preserve raw binary input.
I also would very much like it if I could prevent a scalar from exceeding the value of 0xF, thereby ensuring that it behaves as a single byte all of the time; and throws an exception when trying to place a value that is too large into the it.
Many thanks. If I haven't defined the problem clearly enough then please say so, I am grateful for any help.
In reply to How to prevent perl from being clever by SamPointer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |