my $stdout = IO::Select->new(); my $stdout_handle = IO::Handle->new(); $stdout->add($stdout_handle); my $pid = open3( undef, $stdout_handle, undef, $command ); ...error handling... #### my $stdout = IO::Select->new(); my $stdout_handle = IO::Handle->new(); my $pid = open3( undef, $stdout_handle, undef, $command ); ...error handling... $stdout->add($stdout_handle); #### >perl -e "print qq{abc\n}; warn qq{def\n};" 2>&1 | perl -pe "s/^/$. /" 1 def 2 abc