#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; my $host = 'ftp.cpan.org'; my $user = 'anonymous'; my $pass = 'anonymous'; my $cmd = exec("ping", "$host"); my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout, "\n";