http://www.perlmonks.org?node_id=104658

Q&A > programs and processes > How do I fork a daemon process under Win32? - Answer contributed by tachyon

You can use Win32::Console to fork a detached/daemon process. Here is a little alarm clock example. When it runs it pops a console and asks for a sleep time. It then detaches from the console which closes. Next it forks. The parent just exits whilst the child sleeps for x seconds, pops a new console window and prints a message (just to prove it is alive and kicking). This new console disappears when the child exits 5 seconds later.
#!/usr/bin/perl -w use strict; use Win32::Console; my $con = Win32::Console->new(); $con->Display; $con->Write("Sleep how many seconds? "); chomp(my $sleep = <STDIN>); $con->Free(); # detache our script from the console which closes # now let's fork of an alarm clock child defined ( my $pid = fork() ) or die "Can't fork $!\n"; if ($pid) { exit; } else { sleep $sleep; $con->Alloc() or die $!; $con->Write("BZZT - this is your wake up call"); sleep 5; exit; }