如何在 Perl 的 system() 中使用 shell 的进程替换?

nev*_*int 2 unix linux perl

为什么 Perl 的这一行会中断?

system("paste <\( cut -f2 $file \) $file2 > $fileout");
Run Code Online (Sandbox Code Playgroud)

正确的做法是什么?

bri*_*gge 5

这通常是因为 Perl 使用 sh 而不是 bash 来执行系统命令。快速的答案是在命令开头包含bash -c 。更好的答案在这里:

如何在 Perl 的 system() 中使用 bash 语法?