#!/usr/bin/perl -w use strict; use Net::SFTP; # Net::SFTP does no error reporting my $sftp = undef; eval{ $sftp = Net::SFTP->new("hostnumber", user=>"me", password=>"mypass", ); }; if ($@) { print "Sftp connection failed:\n $@\n"; } if (! $sftp) { print "I can't connect!\n"; }else{ print "SUCCESS!\n"; }