Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Binary decoder

by Aristotle (Chancellor)
on Feb 19, 2005 at 02:14 UTC ( #432610=note: print w/replies, xml ) Need Help??

in reply to Binary decoder

Look ma, no unpack!

#!/usr/bin/perl use strict; use warnings; while(<DATA>) { our $val = 0; # in-regex code is a closure... () = $_ =~ /1(?{$val+=1<<(pos()-1)})/g; print $., "\t", $val, "\t", chr($val), "\n"; } __DATA__ 01101010 10010101 01010101 01011011 01001101 01101010 10011011 01010000

Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://432610]
[marto]: good music, is good music, ignore the genre :P
[Corion]: marto: Thank you, reminds me of good times ;))
[Corion]: holli: If you are in Frankfurt, I can recommend the Ubahnkontrollöre - they have two gigs, one on the 28th Dec., the next in May 2018
[Corion]: They don't do new material anymore, but the old stuff is good enough IMO :)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2017-11-18 19:24 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.