!/usr/bin/perl use strict; use warnings; use Net::FTP; use constant HOST => 'ftp.cpan.org'; use constant DIR => '/mnt/lib'; use constant FILES => 'libs'; my $ftp = Net::FTP->new( HOST, Debug => 1, Passive => 1, Timeout => 1 ); $ftp->login('anonymous'); $ftp->cwd(DIR); $ftp->binary; foreach my $file(FILES) { $ftp->put($file) or die "$@\n"; } $ftp->quit;