## @ftp is an array holding the name of the respective ftp servers for ($i=0;$icreate("ftp_exec",$ftpconnect[$i],$command[$i]); ## this is where it seems it's blocking? or just taking an awful long time to create each thread. ## although it's necessary that the commands get executed at the exact same time everywhere. } ######## maximum time a command takes is around 30 seconds ######## sleep(30); for ($i=0;$ijoin(); } ### subs sub ftp_connect { my ($remoteHost, $remotePort, $remoteUser, $remotePwd, $remotedir) = @_; my $ftp = Net::FTP->new($remoteHost,Port=>$remotePort,Debug=>1); if ($ftp) { $ftp->login($remoteUser,$remotePwd); if (!$ftp->cwd($remotedir)) { $ftp->quit; return ("directory doesn't exist?"); } $ftp->type('I'); } return ($ftp); } sub ftp_exec { my ($ftp,$cmd) = @_; $ftp->quot("$cmd"); $ftp->quit(); }