If that's all you need it for, I'd probably use the shorter, and more informative, file command (available on every Unix and Unix-like system that I've used in the last 40 years) rather than a Perl one-liner.
$ file /usr/bin/perl /usr/bin/perl: PE32+ executable (console) x86-64 (stripped to external + PDB), for MS Windows, 11 sections $ file /usr/bin/perl > file_perl $ file file_perl file_perl: ASCII text $ perle 'say -T "/usr/bin/perl" ? "text" : "binary"' binary $ perle 'say -T "file_perl" ? "text" : "binary"' text
In case you haven't yet picked up on ++eyepopslikeamosquito's reference:
$ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E +'
— Ken
In reply to Re^2: How to use the -T file op as a one-liner
by kcott
in thread How to use the -T file op as a one-liner
by kwolcott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |