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"; }