use Net::SSH2; use strict; my $ssh = Net::SSH2->new(); $ssh->connect("host") or die "Unable to connect host\n"; $ssh->auth_password("id", "password") or die "Failed to auth\n"; my $channel = $ssh->channel() or die "Channel creation failed\n"; $channel->exec("wc *"); while (<$channel>) {print;}