in reply to Re^2: open (to read) and kill a pipe to a pipe
in thread open (to read) and kill a pipe to a pipe

open2 mixes STDERR into STDOUT, its arguments are "backwards", and it just ends up calling open3 anyway. I avoid it.

use strict; use warnings; use IPC::Open3 qw( open3 ); my $file = $ARGV[0]; open(local *TO_CHAIN, '<', $file) or die("Can't open \"$file\": $!\n"); my $gz_pid = open3('<TO_CHAIN, local *PIPE, '>STDERR', 'gzip -dc'); my $mc_pid = open3('<PIPE', local *FR_CHAIN, '>STDERR', 'mycommand'); while (<FR_CHAIN>) { print; }