for my $c (@car_links) { threads->create(sub { threads->detach; # Reserve for 30 min. total. for (1..6) { reserve_car($c, $username, $password); sleep 300; } }); push @known_cars, $c; write_url_to_known_cars($c, $fh); }