My program is reading in a file, line by line. But if a non printable character is found (ex. characters with decimal value less than 32), then I just want to output an error message to the console.
Here is what I have
while($line=<FILE>){
print $line;
$line =~ s/^\s+//; #remove leading spaces
$line =~ s/\s+$//; #remove trailing spaces
if(/[\x00-\x1F]/){
print "Found a non printable!";
}
I’m not sure if it is working, because I guess I’m not sure what the non printable would be in my file?
This is my current input file:
Pa$$word412
999
Wouldn’t a carriage return be non-printable? Then shouldn’t my warning message be printed?
Thanks!
A carriage return is non-printable, by your definition; but you are removing the carriage return from your input when you say