use strict; use warnings; @ARGV == 1 or die("Usage: $0 FILE\n"); my $in = shift; open(INFILE, '<', $in) or die("Can't open $in for reading: $!\n"); while () { chomp; for my $char (split //) { my $ord = ord($char); if ( $ord < 9 || ($ord > 10 && $old < 32) || $ord > 126 ) { print("$in contains illegal character \(ord:\ ", "$ord\) on line $.\n"); } } } #### use strict; use warnings; while (<>) { chomp; for my $char (split //) { my $ord = ord($char); if ( $ord < 9 || ($ord > 10 && $old < 32) || $ord > 126 ) { print("$Input contains illegal character \(ord:\ ", "$ord\) on line $.\n"); } } } #### use strict; use warnings; while (<>) { chomp; while (/[^\x09\x20-\x7E]/g) { print("Input contains illegal character \(ord:\ ", "$ord\) on line $.\n"); } }