in reply to how to Check file type?

If you just want to get the extension of filename, then use File::Basename

eg:

use File::Basename; ($name,$path,$suffix) = fileparse($fullname,@suffixlist); $name = fileparse($fullname,@suffixlist);

The second argument of fileparse is either a literal list of acceptable extensions, or a regular expression, that will match acceptable extensions, so for normal DOS style extensions, you would write:

$name,$path,$suffix) = fileparse($fullname,qr/\..*/);

If you wan't to find out what type a file is, and you can't use, or don't trust the filename, then something like the unix file utility may be helpful. It reads the file contents, and attempts to guess the file type from what it finds. In my experience it is usually correct.