use strict; use warnings; use Net::SSH::Perl; use Net::SFTP; my $host = "sftp.someone.com"; my $user = "user"; my $pass = "pass"; my $home = "/path/to/file.txt"; my $path = "/new/path/to/file"; my $sftp = Net::SFTP->new($host, "user" => $user, "password +> $pass, debug =>1) || die "can't login $!\n"; $sftp->put($home,$path) || die "can't open: $!"; $sftp->quit # I'm guessing on that because there isn't a way listed in the CPAN docs about how to close.