#!/usr/bin/perl use strict; use warnings; use Net::SFTP::Foreign; use Net::SFTP::Foreign::Attributes; use Net::SFTP::Foreign::Constants qw( :status ); use Net::SFTP::Foreign::Util qw( fx2txt ); use Archive::Zip qw( :ERROR_CODES ); ... my %conn_args = ( "user" => $remote_user, "port" => $remote_port, ); $sftp = Net::SFTP::Foreign->new( $remote_host, %conn_args ); ... unless ( $sftp->put( $file, $remote_file ) ) { ... error handling code ... }