in reply to Trying to write a subroutine to return if file is Text or Binary
I was playing around with this and expecting to post something clever about how -B doesn't mean binary - according to the documentation it means "not ASCII", which ain't the same as binary. However ...
文本$ perl -v This is perl, v5.8.8 $ cat foo
(this is apparently Chinese for "text") $ perl -e 'print -T "foo"' 1 $ perl -e 'print -B "foo"' $
So even as far back as 5.8.8 it DTRT, although the documentation is wrong.
Update: sorry for the bad formatting - perlmonks doesn't like me cutting and pasting funny foreign characters into a <code> block.
|Replies are listed 'Best First'.|
Re^2: Trying to write a subroutine to return if file is Text or Binary
by csorrentini (Acolyte) on Jun 26, 2014 at 17:05 UTC
by DrHyde (Prior) on Jul 02, 2014 at 10:14 UTC
In Section Seekers of Perl Wisdom