What is "text"? I like merlyn's definition:

"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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.