in reply to Understanding File Type

use File::MMagic; my $path='/path/to/file.doc'; my $mm= new File::MMagic; #use internal magic file my $t = $mm->checktype_filename("$path"); # $t holds mime type- doesn't matter what the file extension or no ext +ension is

Replies are listed 'Best First'.
Re^2: Understanding File Type
by sanPerl (Friar) on Mar 20, 2006 at 06:32 UTC
    Dear Monks
    'MMagic' as well as 'file <namefile>' (on Linux) are really good solutions
    Thanks to all for the suggestions

    Regards,
    Sandeep