in reply to Re: How can I tell if a string contains binary data or plain-old text?
in thread How can I tell if a string contains binary data or plain-old text?
Odd, really. It works with a regular file, but not with an in-memory file... Bug?
$ perl -e '$a="abc"x500;open A,"<",\$a;$x=-T(A); print +(defined($x)?$ +x?"text":"bin":"undef"),$/;close A' undef $ perl -e '$a="abc";open A,"<","/tmp/index.html";$x=-T(A); print +(def +ined($x)?$x?"text":"bin":"undef"),$/;close A' text
-- dakkar - Mobilis in mobile
Most of my code is tested...
|
---|
In Section
Seekers of Perl Wisdom