my $line = ''; foreach my $i (1..length($bytes)) { my $char = ord substr($bytes, $i - 1, 1); $line .= encode_bits($char >> 4) . ' '; $line .= encode_bits($char & 15) . ' '; if(length($line) > 80) { print $line, "\n"; $line = ''; } } print $line, "\n";
sub encode_bits { my($bits) = @_; my $el = $nyb{$bits}; return $el->[ rand($#{$el}) ]; }