my %args = (user => encode("iso-8859-1", $ftp_user) , password => encode("iso-8859-1", $ftp_passwd)); $args{ssh_args} = [ port => encode("iso-8859-1", $ftp_port) ] if $ftp_port; $sftp = Net::SFTP->new($ftp_url, %args); return 0 if (!$sftp); $sftp->ls($ftp_additional_path, sub { my $ref = shift; if ($ref->{'filename'} =~ /_3rdParty_/) { $files->{$ref->{'filename'}} = 1 } }); print (keys %{$files}); $sftp->get(encode("iso-8859-1", $ftp_file), $local_file); my ($statuscode, $statustext) = $sftp->status; $log->error("\nFile not found") if($statustext ne "No error");