use Net::FTP; $strFTPServer = <>; $strFTPUserName = <>; $strFTPPassword = <>; newFTPConn(); sub newFTPConn() { $ftp = Net::FTP->new("$strFTPServer", Passive => 0, Debug => 0) || retryModule("Could not connect to FTP Server $strFTPServer: $!"); $logger->info("Successfully connected to FTP Server $strFTPServer"); $ftp->login("$strFTPUserName","$strFTPPassword") || errorModule("UserName or Password incorrect for user $strFTPUserName: ".$ftp->message,1); $logger->info("Successfully logged into $strFTPServer"); }