in reply to Re^3: How to check whether the file is a stringin thread How to check whether the file is a string
Or File::LibMagic which directly uses the same library the file uses