First, there is no fork(2) call on Windows, so (as other monks have mentioned) Windows perls implement fork using interpreter threads. The obvious problem here is that creating a thread or forking a subprocess completes immediately and the main thread continues, then exits at the end of the script while the children are waiting at sleep 300. When the main thread exits the process, Windows kills the other threads.
On Linux, threads are implemented in terms of clone(2), which is a fork-like call, (NPTL added new system calls with different names long ago but has very similar semantics) so threads are actually lightweight processes. (The Linux kernel calls them both "tasks" instead of distinguishing threads and processes.) Again, both programs will do the same (different) thing: the original process spawns the others and exits, but under Linux, the created threads are more like forked processes, so either they continue to run after the parent exits or the kernel blocks the parent at exit(2) until the other threads complete.
For a solution, try either wait/waitpid or the ->join() method in threads instead of detaching your worker threads.