我试图用perl脚本从stdin阅读。
这是我用于测试的脚本:
#!/usr/bin/perl
foreach $line (<>)
{
print $line;
}
所以从命令提示符中,我输入:
> cat somefile | testscript
>
它没有返回而没有错误。
i然后输入以下内容:
> cat somefile | perl testscript
> *the contents of the file are printed line by line*
我真的不希望用户在脚本面前附加perl。
感谢您的阅读。
我认为您运行了两个不同版本的perl。"哪个perl"的输出是什么?