my @output; $chan->blocking(1); $chan->exec('nas_server -list'); while (<$chan>) {push @output, $_} print for @output;