On Monday August 20, 2007, "David Weintraub" <[EMAIL PROTECTED]> 
wrote:
> I would use a Perl script to read the first 8000 or so bytes of a
> file and look for characters outside of what you'd expect to be
> ASCII range.

Using Perl, the -T (for text) and -B (for binary) flags do pretty much 
exactly that and work really well. For example:

$myfile = "some.file"

if ( -B "$myfile" ) {
    # file is binary
}
else {
    # file is text
}

- Rob





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to