zuqif, the script I posted above is intended to launch another script in the background (daemon.pl in the example).
So, you need to change whatever needs to be changed to match your system (my perl install dir is non orthodox)
I tested the script before posting (even tryed to do a use strict, but it barfed some errors related to Win32 and I droped it, since this was just a code sample) and it worked as intended (by me, at least ;^)
I'll put here the progie that I used as the background process, save it as daemon.pl in the same dir as the previous code and the try running the previous code and checking for the c:\daemon.log file
use strict;
my $log_file = 'c:\daemon.log';
open (LOG, ">$log_file") || die ("cant create $log_file : $!");
for ($i = 5 ; $i > 0 ; $i--) {
print LOG "daemon running $i\n";
# print "daemon running $i \n";
sleep(1);
}
print LOG "thats all folks\n";
close LOG;
The first script could even acept as parameters the name of the perl script it should run in the background,