Is there a CPAN module for this kind of thing?
There are numerous. Some of them even work on scalars, not only filehandles. Have a look at File::MimeInfo::Magic and File::LibMagic for a start.
For most similar tasks, yet not for your actual one you may find File::MMagic most useful.
Cheers, Sören
In reply to Re: Distinguishing text from binary data
by Happy-the-monk
in thread Distinguishing text from binary data
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |