#! perl -slw use strict; use threads; use Thread::Queue; use Net::FTP; my $THREADS = 10; my $Q = new Threads::Queue; my @threads = map async { my $ftp = Net::FTP->new("host.com"); $ftp->login('blah','blah'); $ftp->ascii(); while( defined( $_ = $Q->dequeue ) ) { $ftp->put( $_ ); } $ftp->quit(); }, 1 .. $THREADS; my @files = getFiles(); $Q->enqueue( @files ); $Q->engueue( (undef) x $THREADS ); $_->join for @threads;