in reply to binary to ascii convertion
Run it from the command line like this: myscript.pl filenameuse warnings; use strict; while(<>) { for my $char (split '') { my $ord = ord($char); print $ord > 31 && $ord < 128 ? $char : '?' } }
Run it in the same way as before.use warnings; use strict; open (my $handle, '<', $ARGV[0]) or die "Unable to open $ARGV[0]: $!"; binmode $handle; while(read ($handle, my $buffer,80)) { for my $char (split '', $buffer) { my $ord = ord($char); print $ord > 31 && $ord < 128 ? $char : '?' } print "\n"; }
|
|---|