use strict; use warnings; use IPC::Open3; my($wtr, $rdr, $err); my $pid = open3($wtr, $rdr, $err,'ssh nyx'); unless ($pid){ $wtr = ; until ($wtr eq 'q'){ while (<$rdr>){print} while (<$err>){print} $wtr = ; } } waitpid( $pid, 0 );