#!/usr/bin/perl use strict; use Net::SFTP; my $host = 'sftp.section111.cms.hhs.gov'; my $user = 'myUser'; my $pass = 'myPass'; #open connection eval { #timeout if no response within 120 seconds $SIG{ALRM} = sub {die "Net::SFTP timed out\n"}; alarm(120); my $sftp = Net::SFTP->new($host,user =>$user,password=>$pass, ssh_args=>[port=>10022],debug =>0) || die "Can't connect $ [at] \n"; alarm(0); }; if ($@) { alarm(0); chomp( $@ ); die("Error: $@ trying to connect to CMS \n"); } else { $sftp->ls("/000014928/response/prod/query-only" , sub { print $_[0]->{longname}, "\n" }); die("Success: $@ has connected to CMS \n"); } /csapps055/gentran/test/script $ demo5.pl Global symbol "$sftp" requires explicit package name at demo5.pl line 25. Execution of demo5.pl aborted due to compilation errors.