#!/usr/bin/perl use strict; use warnings; use 5.010; system('cls'); require Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('server .com') or $ssh2->die_with_error; $ssh2->auth_password('user','pw') or $ssh2->die_with_error; my $chan = $ssh2->channel() or $ssh2->die_with_error; $chan->exec("cd /www/verz"); $chan->exec("ls"); print while <$chan>; print "EXIT CODE: ",$chan->exit_status,"\n"; $chan->close;