$out = map { substr unpack('B8', $1), 1 } $string =~ /./g;