#!/usr/bin/perl -w
# forker.pl
use strict;
my $pid = fork();
if ($pid == 0)
{
exec("/tmp/busy_wait.pl");
}
elsif (!defined($pid))
{
die "could not fork";
}
print "This is the parent process\n";
####
#!/usr/bin/perl -l
# busy_wait.pl
while (1)
{
print "Busy!";
sleep 2;
}
####
[matt@megatron ~]$ /tmp/forker.pl
Busy!
This is the parent process
[matt@megatron ~]$ Busy!
Busy!
Busy!