Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Encode and decode binary-coded decimals

by jmcnamara (Monsignor)
on Oct 08, 2002 at 17:44 UTC ( #203703=note: print w/ replies, xml ) Need Help??


in reply to Re: Encode and decode binary-coded decimals
in thread Encode and decode binary-coded decimals


In the first case you need to use 0396 instead of 396. That's what the comment about "zero padding" refers to.

$ perl -le 'print join " ", map {ord pack "H2", $_} shift =~ /../g +' 0396 3 150

I'd expect to get: 0011 1001 011

That is at odds with my expectation.:-) Nevertheless, it isn't too difficult to change these routines to support other ascii, hex or binary representations.

--
John.


Comment on Re: Re: Encode and decode binary-coded decimals
Download Code
Re: Re: Re: Encode and decode binary-coded decimals
by jryan (Vicar) on Oct 08, 2002 at 20:23 UTC

    My definition of BCD is similar to this, but maybe you are referring to something different? :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://203703]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-26 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (179 votes), past polls