in reply to Distinguishing text from binary data
You could look at the perl implementation of the unix file utility. It is(was) part of the PPT project.
Once (shame on you!)
Twice (shame on me!)
More often than I'd like to be
All the time
Just when answering stupid polls
Who you callin' a fool?
I refuse to vote in this ridiculous poll
Results (447 votes). Check out past polls.