use Net::OpenSSH; my $ssh = Net::OpenSSH->new($host); my $sftp = $ssh->sftp; $sftp->put($from, $to); $ssh->system(perl => $script, $to);