#!/usr/bin/perl use strict; use warnings; use Net::SFTP::Foreign; use Fcntl qw(SEEK_END); my ($host, $file, $user, $pwd, $port) = undef; my $sftp = Net::SFTP::Foreign->new($host, $user, $pwd, $port); $sftp->error and die "Unable to connect to remote host: ".$sftp->error."\n";