Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Decode a binary string

by BrentDax (Hermit)
on Apr 01, 2004 at 20:32 UTC ( #341783=CUFP: print w/ replies, xml ) Need Help??

So, staring at Thinkgeek's latest creation and wondering what the hell it says? This handy dandy binary decoder can tell you! Just feed it a string of binary digits, and it'll convert them to their ASCII equivalent.

perl -e'$_=<>;print+(map{chr(eval"0b$_")}unpack"a8"x(length($_)/8),$_),"\n"'

(Better versions quite welcome...)

=cut
--Brent Dax
There is no sig.

Comment on Decode a binary string
Download Code
Re: Decode a binary string
by jmcnamara (Monsignor) on Apr 01, 2004 at 20:51 UTC

    Here's one way:
    perl -le 'print pack "B*", pop' 0100100001101001

    --
    John.

      ...d'oh.

      There's a reason my Perl geek code includes "I pack and unpack my suitcase."

      =cut
      --Brent Dax
      There is no sig.

Re: Decode a binary string
by CloneArmyCommander (Friar) on Apr 07, 2004 at 16:05 UTC
    I s h o 01001001 00100000 01110011 01101000 01101111 p p e d 01110000 01110000 01100101 01100100 00100000 a t T h 01100001 01110100 00100000 01010100 01101000 i n k g e 01101001 01101110 01101011 01000111 01100101 e k o n 01100101 01101011 00100000 01101111 01101110 A p r i 00100000 01000001 01110000 01110010 01101001 l F o o 01101100 00100000 01000110 01101111 01101111 l s d a 01101100 01110011 00100000 01000100 01100001 y l a n 01111001 00101100 00100000 01100001 01101110 d a l l 01100100 00100000 01100001 01101100 01101100 I g o 00100000 01001001 00100000 01100111 01101111 t w a s 01110100 00100000 01110111 01100001 01110011 t h i s 00100000 01110100 01101000 01101001 01110011 l o u s 00100000 01101100 01101111 01110101 01110011 y s h i 01111001 00100000 01110011 01101000 01101001 r t ! 01110010 01110100 00100001
    :). Hahaha :). Although binary isn't really that hard to get the hang of reading :), especially when you know the short-cuts with decoding the alphabet :).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2014-07-14 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls