IPC::Open2 の簡単サンプル
2007-01-15-6
[Programming]
Perlプログラミングメモ。
IPC::Open2 の自分用 SYNOPSIS。
IPC::Open2 の自分用 SYNOPSIS。
実行例:#!/usr/bin/perl use strict; use warnings; use IPC::Open2; my $pid = open2(\*RDR, \*WTR, 'cat -n'); while (<>) { print WTR $_; } close WTR; while (<RDR>) { print; } close RDR;
% head -3 sample.pl | ./sample.pl 1 #!/usr/bin/perl 2 use strict; 3 use warnings;