http://www.perlmonks.org?node_id=770237


in reply to understanding file type

binary files have a unique identifier embedded into the header of the file.eg a PDF file starts with '%PDF-1.3' use a Hex editor and look at the header of the file, or programmatically read the first few bytes from the header and identify the file format.basically look at the documentation of the format