in reply to differentiate pdf and ppt

If you read the first few bytes of a PDF file, it always starts with "%PDF" and the version number. I think that is all you need.

Replies are listed 'Best First'.
Re^2: differentiate pdf and ppt
by sarvan (Sexton) on Sep 05, 2011 at 18:21 UTC
    Hi bart, Can you please tell me how can i do that.
      Sheesh, I would think that even any beginner in Perl should be able to tackle this. The tasks you have to do:
      1. read the first few bytes of the file (at least 4 bytes) into a string
      2. see if the string starts with '%PDF'