in reply to How reliable is -T as a test for ASCII files?

The problem with -T is it's not very "intelligent". It will find a postscript graphics file, and call it text.

So you might want to do some intelligent filtering with a modules like MIME::Types.

use MIME::Types; my $mimetypes = MIME::Types->new; my MIME::Type $plaintext = $mimetypes->type('text/plain'); print $plaintext->mediaType; # text print $plaintext->subType; # plain
You could also do some extension testing depending on the type of files you have on your system.

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re: Re: How reliable is -T as a test for ASCII files?
by Anonymous Monk on May 13, 2004 at 23:21 UTC
    That's exactly the kind of answer I was hoping for!

    Thanks very much for your help.