use Net::SSH2; use strict; my $ssh = Net::SSH2->new(); $ssh->connect("curry") or die "Unable to connect host\n"; $ssh->auth_password("aabchts4", "doneit") or die "Failed to auth\n"; my $channel = $ssh->channel() or die "Channel creation failed\n"; $channel->exec("wc"); $channel->write("abc def\n"); $channel->write("abc def\n"); $channel->send_eof(); while (<$channel>) {print;}