作者gecer (gecer)
看板Perl
标题[问题] 请问如何从batch file给 STDIN
时间Fri Jan 29 23:16:10 2016
如题 我有一个perl 执行时会等待输入stdin 但是我有大量的资料要经过这个perl处理
请问如何从batch file 写入 stdin?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.255.20.25
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Perl/M.1454080573.A.6F0.html
1F:推 herculus6502: | 01/30 07:01
愿闻其详 例如像这样吗? perl |变数1 |变数2
※ 编辑: gecer (111.255.20.25), 01/30/2016 10:42:30
2F:→ abliou: 只有"两行"的问题,大概不会有大於两行的答案 01/30 15:31
假设我有个perl code
my $o=<STDIN>;
print "$o\n";
my $c=<STDIN>;
print "$c\n";
想用batch file 去执行 但是我不想等从键盘输入stdin 所以想写batch file 去执行上面
的perl code
perl test.pl <first stdin> <second stdin>
perl test.pl <first stdin> <second stdin>
perl test.pl <first stdin> <second stdin>
perl test.pl <first stdin> <second stdin>
不知道batch file 语法要怎麽写
※ 编辑: gecer (111.255.20.25), 01/30/2016 17:27:04
3F:推 LiloHuang: 可以考虑把 <STDIN> 改成 $ARGV[0], $ARGV[1] 以此类推 01/30 19:55
4F:推 flu: 原po你要的资料来源是叫作命令列引数,不叫stdin喔 01/30 21:43
5F:推 flu: perl的神奇运算子<>有跨界处理命令列引数(为名的档案)和stdin 01/30 21:46
6F:→ flu: 虽然方便但要小心混淆 01/30 21:47