libfile-type-perl | determine file type using magic structure | Mehr ...
File::Type uses magic numbers (typically at the start of a file) to determine the MIME type of that file. . File::Type can use either a filename, or file contents, to determine the type of a file.