my $chan = $ssh2->channel(); $chan->blocking(0); $chan->exec('ls -la'); while (<$chan>){ print; # regex the output here to determine what to get }