http://www.perlmonks.org?node_id=432610


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.