|go ahead... be a heretic|
Re: Encoding BCDby Corion (Pope)
|on Jun 13, 2007 at 15:49 UTC||Need Help??|
does not do what you think it does. Most likely you want to use one of the comparison operators, eq for string comparison or == for numerical comparison. Look at:
I use the following to convert a BCD string to a Perl number/string:
In your case, maybe you want to throw away all the sign handling. The code could then be:
When debugging string packing/unpacking problems, I often write me a test suite to make sure all my assumptions about the data get documented somewhere. You might want to use something like the following:
and then add all cases from your actual input data that you find interesting/problematic.