"If there's not much weird stuff, then it looks like text".
Binary isn't as much fun: null bytes, unusual control chracters, bytes with the high bit set. Perl has to guess at what the file is most of the time, and it's right most of the time; however, sometimes it makes mistakes. If a file can't be read, doesn't exist, or is given an incorrect path, then Perl will say that it's not text and not binary. Maybe that's what is happening here. I would do a simple test on a few files to find out what's wrong. I used a simple if:
#!/usr/bin/perl use strict; use warnings; my $fullelementpath = shift @ARGV; if ( -T $fullelementpath) { print "This is a text file\n"; } else { print "This is not a text file\n"; } if ( -B $fullelementpath ) { print "This is a binary file\n"; } else { print "This is not a binary file\n"; }
In reply to Re: File test -T (text) and quoted filenames
by Khen1950fx
in thread File test -T (text) and quoted filenames
by AdamtheKiwi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |