use strict; require Encode::EUCJP1997OPENNEC; while (<>) { my $file_name = $_; $file_name =~ tr/\x0d\x0a//d; warn $file_name . "...\n"; open my $file, '<', $file_name; local $/ = undef; my $c = <$file>; $c =~ s/[\x00-\x7f][\xa0-\xff][\x00-\x7f]//g; eval { Encode::decode ('euc-jp-1997-open-nec', $c, 1); 1; } or warn $@ and print "ERR: $file_name\n"; }