in reply to
Re^2: perl: FTP using cgi not working but FTP s/w works well
in thread perl: FTP using cgi not working but FTP s/w works well
As a few of us said in the CB, you're likely suffering from the ftp-data port being blocked (incoming to your web server), combined with the FTP server not implementing PASV. If that's true nothing you change in your code will make it work.
Even if your desktop PC receives ftp-data connections OK, that's no reason to believe that your network administrator has allowed the same for the web server.
Either have your network administrator sort it out, or use another protocol. (eg: scp, webdav, rsync, etc)