Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Encode and decode binary-coded decimals

by jryan (Vicar)
on Oct 08, 2002 at 16:59 UTC ( #203693=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    perl -le 'print join " ", map {ord pack "H2", $_} shift =~ /../g' 396
  2. or download this
    perl -le 'print unpack "H*", pack "C*", @ARGV' 0011 1001 0110
  3. or download this
    # encode
    perl -e 'print sprintf("%04b ",$_) for shift =~ /\d/g' decimal
    perl -e '$p=1; map{$l+=oct("0b$_")*$p;$p*=10} reverse @ARGV; print $l'
    + bcddigit1 bcddigit2 etc

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://203693]
erix is always in favour of code-revolutions
[Lady_Aleena]: Well, right now, I"m looking at modules where I put randomness that aren't in my RolePlaying/Random dir, like RolePlaying:: Character:: Alignment that is mostly about random_alignment than expand_alignment.
[erix]: cute

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-05-27 20:34 GMT
Find Nodes?
    Voting Booth?