my $cmd = '/opt/rssh/bin/ssh'; my $machine = "remote_machine"; open(my $fh, "-|", "$cmd $machine \"hostname;uptime\" 2>&1") or die "cannot open fh"; #my $flags = fcntl($fh, F_GETFL, 0) or die "\ncan't get flags for the pipe: $!\n"; #fcntl($fh, F_SETFL, $flags | O_NONBLOCK) or die "\ncan't set flags: $!\n"; my @result ; while (<$fh>) { # chomp; push @result,$_; } print "\nresult is: @result \n";