Because "detach" doesn't do what you'd expect. Detached threads are terminated when the program exits. From the docs...
$thr->detach()
Makes the thread unjoinable, and causes any eventual return value to be discarded. When the program exits, any detached threads that are still running are silently terminated.
You should have gotten a message like this.
Perl exited with active threads:
1 running and unjoined
0 finished and unjoined
0 running and detached
Instead of detaching, you should wait until all threads are complete at the end of your program.
for my $thread (threads->list(threads::running)) {
$thread->join;
}
If all you want is to make parallel HTTP requests, there's no need for threads. LWP::Parallel will probably be more efficient.