use strict; my $file = shift or die 'must supply filename'; open my $fh, $file or die "couldnt open $file: $!"; $\="\n"; while (<$fh>) { # print $.,$/; my $char; while (/\G(.)/g) { ++$char; my $c=$1; if ($c =~ /[[:^print:]]/) { print "plain_text test failed on row $. with char # $char: <$c>\n" . "Unicode Value: " . unpack('C', $c); print "context: " . substr($_, 0, $char+5); } } }