Here's an extremely simplistic example of how to fork a child process off and have it running alongside the parent... if you want to do something simple and non-vital, you could do it this way...
beware though, there are many problems and pitfalls with forks. (
perhaps in a future version of perl, there'll be a spork() function that will eliminate some of the problems with fork() :))
To use this code, just replace the while() loops with whatever function calls you need to make... hope it helps
#!/usr/bin/perl
use strict;
my $k_pid;
die "Can't fork! ($!)" unless defined ($k_pid = fork());
my $i = 1;
my $n = 1;
if ($k_pid) {
#parent code
while (1==1) {
$n++;
print "Parent ($i)($n) \n";
sleep(1);
}
kill("TERM" => $k_pid);
} else {
#child code
while (1==1) {
$i++;
print "Child: ($i)($n)\n";
sleep(1);
}
}