Perl で実行するシステム コマンドの出力用のファイルハンドル/ハンドルはありますか?
質問する
2981 次
2 に答える
12
の 3 引数形式を使用して、スクリプトと他のコマンドの間にパイプを確立する例を次に示しますopen
。
open(my $incoming_pipe, '-|', 'ls -l') or die $!;
open(my $outgoing_pipe, '|-', "grep -v '[02468]'") or die $!;
my @listing = <$incoming_pipe>; # Lines from output of ls -l
print $outgoing_pipe "$_\n" for 1 .. 50; # 1 3 5 7 9 11 ...
于 2010-07-14T03:01:28.197 に答える