LINE : /home/rob/pscrpt/net-ssh2 LINE : total 12 LINE : -rw-r--r-- 1 rob rob 334 Dec 9 19:51 exec.pl LINE : -rw-r--r-- 1 rob rob 453 Dec 15 11:09 shell.pl LINE : -rw-r--r-- 1 rob rob 443 Feb 10 15:05 shell2.pl #### use warnings; use strict; use Net::SSH2; my $buflen = 500; my $buf = '0' x $buflen; my $ssh2 = Net::SSH2->new(); $ssh2->connect('192.168.0.3') or die "Unable to connect Host $@ \n"; $ssh2->auth_password('user','password') or die "Unable to login $@ \n"; my $chan2 = $ssh2->channel(); $chan2->blocking(1); $chan2->exec("cd /home/rob/pscrpt/net-ssh2 && pwd && ls -lrt"); $chan2->read($buf, $buflen); $chan2->close; chomp $buf; $buf =~ s/\n/\nLINE : /g; $buf = "LINE : " . $buf; print $buf, "\n";