Perl
Perl script as system daemon
A perl daemon
Perl Daemon in Ubuntu
Writing a Perl Daemon
Lateral thinking
Frederick P. Brooks, Jr.
Magic scripta  
A perl daemon
Comments on Writing a Perl Daemon


A perl daemon
Matteo un esempio
The easiest way is to use Proc::Daemon.

....................................................................
#!/usr/bin/perl

use strict;
use warnings;
use Proc::Daemon;

Proc::Daemon::Init;

my $continue = 1;
$SIG{TERM} = sub { $continue = 0 };

while ($continue) {
#do stuff
}
.......................................................................


Alternately you could do all of the things Proc::Daemon does:
Fork a child and exits the parent process.
Become a session leader (which detaches the program from the controlling terminal).
Fork another child process and exit first child. This prevents the potential of acquiring a controlling terminal.
Change the current working directory to "/".
Clear the file creation mask.
Close all open file descriptors.
Integrating with the runlevel system is easy. You need a script like the following (replace XXXXXXXXXXXX with the Perl script's name, YYYYYYYYYYYYYYYYYYY with a description of what it does, and /path/to with path to the Perl script) in /etc/init.d. Since you are using CentOS, once you have the script in /etc/init.d, you can just use chkconfig to turn it off or on in the various run levels..