#!perl use strict; use warnings; use Net::SFTP; my $host = 'localhost'; my $user = 'user'; my $password = 'password'; my %args = ( user => $user, password => $password, port => 22, debug => 1, ); my $local = '/path/to/some/file'; my $remote = '/path/to/remote_dir/file'; my $sftp = Net::SFTP->new($host, %args); die "Can't put file: $!\n" unless $sftp->put($local, $remote); close $local;