NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
-B cheap plastic imitation (Score:2)
3 * tr/\0-\x07\x0e-\x1a\x1c-\x1f\x7f-\xff/\0-\x07\x0e-\x1a\x1c-\x1f\x7f-\xff/ > length
That is, printable and whitespace ASCII and ESC are okay,
others not, and if there are more than 1/3 not okays, call it binary.
Reply to This
Re:-B cheap plastic imitation (Score:2)
That seems like the kind of thing that would be nice to expose in a function, in much the same way uc, lc, and glob started their lives.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re:-B cheap plastic imitation (Score:2)
I dunno... I think the heuristic is so weak (false positives for arguably "text" data, for example), and by definition a binary test (ta-dah!), as opposed to multivalued, that I find little value of exposing that logic. I think e.g. adding my snippet to the FAQ should be quite enough for those who need it.