in reply to data structure question

$ftp_sessions[$nbr] = threads->create("start_ftp", $nbr, $loc);

That line pointed out by jbware is not needed actually, and he is right. As you do not join your threads later, there is no point to keep thread id.