古い記事
ランダムジャンプ
新しい記事
Perlプログラミングメモ。
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;