> On Sep 9, Dan Muey said:
>
> >> if -T $data ....
> >> if -B $data ....
> >
> >I never thought of using the file test operators on variables!
>
> I'm not so sure you can. But the docs say that -B looks for
I was afraid of that. After trying it out I couldn't get any good results.
> at least 30% of the characters to be control-chars or
> high-bit chars. So I'd suggest:
>
>
> sub is_binary_data {
> local $_ = shift;
> (tr/ -~//c / length) >= .3;
> }
>
> The tr/ -~//c takes the range of characters from space to
> tilde (32-126), inverts it (so characters 0-31 and 127-255),
> and counts how many of them are in $_. Then we divide that
> by the length of the string. If that's at least .3, that
> means at least 30% of the string is binary data.
>
Excellent! Since the -B needed to be a file I was thinking about how to mimik the -B
option.
That is excellent, thanks for the explanation and info!
Thanks Jeff!
Dan
> --
> Jeff "japhy" Pinyan [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]