in reply to Capturing command outputs

There's also an XS module available which might be a useful alternative: File::LibMagic

Example (shameless theft from the docs):

use File::LibMagic ':easy'; print MagicBuffer("Hello World\n"),"\n"; # returns "ASCII text" print MagicFile("/bin/ls"),"\n"; # returns "ELF 32-bit LSB executable, Intel 80386, version 1 +(SYSV)" # on my system
HTH