> ls ??? bar foo > ls ??? | cat bar foo
它如何知道,我将如何在Perl中执行此操作?
还有-p测试运算符来指示文件句柄附在管道上.
$perl -e 'printf "term:%d,pipe:%d\n",-t STDIN,-p STDIN' term:1,pipe:0 $perl -e 'printf "term:%d,-p STDIN' < /tmp/foo term:0,pipe:0 $echo foo | perl -e 'printf "term:%d,-p STDIN' term:0,pipe:1
文件测试运算符文档在perldoc -f -X.
perldoc -f -X