for my $c (@car_links) { my $pid = fork(); if ($pid == 0) { # Reserve for 30 min. total. for (1..6) { reserve_car($c, $username, $password); sleep 300; } exit; } push @known_cars, $c; write_url_to_known_cars($c, $fh); } #### 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); }